Enter Baidu to search for the problem and find someone saying this
The default value of async in Ajax in Jquery is true (asynchronous request). If you want to execute another Ajax after Ajax is executed, you need to set async to false.
At that time, I processed it in ajax.
Async: false. The result shows that normal data submission is normal and no error is returned.
The code is as follows: |
Copy code |
$. Ajax ({ Type: "POST ", Async: false, Url: urllink, Data: data, DataType: "html ", Success: function (msg ){ Alert (data) }, Error: function (XMLHttpRequest, textStatus, errorThrown ){ Alert (XMLHttpRequest. status ); Alert (XMLHttpRequest. readyState ); Alert (textStatus ); }, }); |
Last, I would like to add:
The following two errors may occur when an error is sent, or other program problems may occur.
1. data: "{}". If the data is empty, you must pass "{}". Otherwise, the returned data is in xml format. The system prompts parsererror.