sabecs
asked on
jQuery - submit form before ajax call?
Hi,
I need my sendTracking function to submit a form #update_order before executing my process_order_update.php
All works fine except I don't receive an alert back "Updated Order Details Sent to Customers with Tracking Number"?
If I comment out $('form#update_order').sub mit(); then I receive the alert?
Any ideas on how it should be coded would be appreciated.
I need my sendTracking function to submit a form #update_order before executing my process_order_update.php
All works fine except I don't receive an alert back "Updated Order Details Sent to Customers with Tracking Number"?
If I comment out $('form#update_order').sub
Any ideas on how it should be coded would be appreciated.
// view_order_update.php
<input type="button" class="button_sml orange" onclick="sendTracking();" value="Send Tracking Details">
<script>
var sendTracking= function() {
$('form#update_order').submit();
var answer = confirm('This will send an email to the customer with their Delivery Tracking Number.');
if(answer==true) {
var updateURL = "/process_order_update.php?order_id="+<?php echo $order_id; ?>;
$.ajax({
url: updateURL, success: function(data){
alert("Updated Order Details Sent to Customers with Tracking Number");
}
});
}
}
</script>
<?php //process_order_update.php
...
..
echo "Updated Order Details Sent to Customers with Tracking Number";
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks vr6r, that is perfect...
ASKER
It still looks like it's not submitting the form?
<form action="view_upd_order.php
should this line now be?
$.post($('form#update_orde