jQuery(document).ready(function($) { $('#delivery-process-selector').change(function(e){ e.preventDefault(); var data = { action: 'wiaas_create_order_delivery_process', _ajax_nonce: $('#wiaas_create_order_delivery_process_nonce').val(), order: $('#wiaas_order_id').val(), form: e.target.value }; // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php $.post(ajaxurl, data, function(response) { if (response.success){ location.reload(); }else{ alert(response.data[0].message); } }); }); });