Home >Backend Development >PHP Tutorial >Uchome Discuz Uchome ajaxpost tips

Uchome Discuz Uchome ajaxpost tips

WBOY
WBOYOriginal
2016-07-29 08:44:051235browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn