Coast Line
asked on
jquery ajax functionality to respond to internal post and load the data accordingly
Modifying the JS Code to work one by one and based upon inside ajax post, it should process the activation
Here is the code i have
Here is the code i have
$.post('/cfc/mycfc.cfc?method=stop', {id: id}, function(data) {
if(data.status == 1) {
return $.post('/register.html?action=remove' {id: id, pid: $('body').attr('data-pid')},callback,'json');
swal('',data.statusmsg,'success'); - i want to get this inside the second post so it should work properly and trying to make use of async as by using ajax so they get called one by one
CheckPause(data);
$('#wrapper').load( "#Pause");
}else {
swal('',data.statusmsg,'error');
}
},'json')
ASKER
modified like this:
they is a change i would like to make,
1. i want to use the error handling on the first one and if it occurs say _data.status = 0, it should never execute the others, same is the case for the data one, and basically enhance the code to better technique
Thanks
$.ajax(type:'POST',url:'/cfc/mycfc.cfc?method=Pause', data: {id : id}, async: false, success: function(data) {
if(data.status == 1) {
$.post('/register.html?action=Rremove' {id : id, pid : $('body').attr('data-pid')},function(_data) {
if(_data.status == 1) {
swal('',data.statusmsg,'success');
}
});
CheckPause(data);
$('#wrapper').load( "#Pause");
}else {
swal('',data.statusmsg,'error');
}
})
they is a change i would like to make,
1. i want to use the error handling on the first one and if it occurs say _data.status = 0, it should never execute the others, same is the case for the data one, and basically enhance the code to better technique
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why are you doing a return on line 3 - that is going to ensure that lines 4-6 never fire?