I can't do operations after a success of AJAX call
Hi, i noted that calling a php script with this syntax
- $.ajax({
- url: scriptUrl,
- type: "POST",
- data: formdata,
- processData: false,
- contentType: false,
- success: function (res)
- {
- alert (res) //<----This is showed ("success")
- if(res=="success") //<-----------PROBLEM HERE
- {alert("All gone ok")} <---- This is NOT showed
- }
- })
this happen because i dont regularly exit from the php script... In fact if i place "exit;" after the response:
- echo("success");
- exit;
the if statament of the "success" function of ajax regularly works..
Why happen this? I would want to know how ajax works theorically