有没有办法在 $.post 的成功回调中再次拥有 $.post 。如果第一个 $.post 不成功,我会要求提示。如果确认它再次调用执行另一个 $.post
我的代码如下
postvars = {
order_no:order_no,
tracking_no:tracking_no,
continue_submit: false
};
url = '../shipment/shipment_submit_order_status_ajax';
$.post(url, postvars, function(data1) {
if(data1.status == "success")
{
alert("Order submitted 1");
}
else if(data1.status != "success")
{
var r = confirm("The Order is NOT ready to be shipped. Please check the order again. Are you sure you want to continue to ship this?");
if(r)
{
//Submit order
postvars = {
order_no:order_no,
tracking_no:tracking_no,
continue_submit: true
};
url = '../shipment/shipment_submit_order_status_ajax';
$.post(url, postvars, function(data) {
if(data.status == "success")
{
alert("Order submitted 2");
}
}, 'json');
}
}
}, 'json');
它正在执行两个调用,而不是在执行第二个 ajax 调用之前先提示确认对话框。任何人有任何解决方案?提前致谢