Sunday, 15 June 2014

javascript - Asynchronous Request Fails, whereas Synchronous Request makes way through and works as expected -


I have been temporarily tweaking this script and as I mentioned in this question, my code only Works fine in non-simultaneous mode, while when I change the async: true , the code still fails.

This is my code.

  $ .ajax ({Type: "POST", url: "http://someotherserver.com/sendmail.php", data: {resp: data}, async: false}) .done (function) (warning): / / when Async: is incorrect}} .file (function (jxaxhr, textstatus) {if (textStatus == 'timeout') {Warning ('failed with timeout' );}});   

sendmail.php is nothing more than that which is enabled by CORS on my friend's server. / P>

sendmail.php

  & lt ;? php file_put_contents ('request.txt', json_encode ($ _ Request)); Copy "filecreated";  

The problem occurs when I Change async: true , the request.txt file is never created on that server, whereas if I change the async: false it works as expected. / P>

The thing is that I do not want this request to be asynchronous , synchronous.

Can anyone have any idea this? , I will be ready to provide.


No comments:

Post a Comment