For example, the default submit button operates like this: >Copy code The code is as follows:
function checkPostResult(){
var cid = setInterval(function(){
if( $('__formid').innerText == 'success '){
alert('Submission successful');
location.href='xxxxx.php';
clearInterval(cid);
}
},1000);
}
This process is also very simple, why? Use setInterval and clearInterval mainly because ajax is an asynchronous operation. If the setInterval method is not used, then when the ajaxpost ends, the prompt information has not actually been appended to the ID where the prompt information is located, so the setInterval method is used to delay first and then loop through it. End prompt. . .
clearInterval is not used correctly, but I can’t think of a better one in a short time. This is a temporary solution first.
The above introduces uchome Discuz Uchome ajaxpost tips, including uchome content, I hope it will be helpful to friends who are interested in PHP tutorials.