I encountered a problem at work today
The code is as follows:
var status=1;
var ob=$("[name='email']");
$.ajax({
url:"{:U('Home/Index/checkemail ')}",
data:"email=" query.email,
type:"post",
dataType:"json",
success:function(re){
status =0;
}
});
alert(status);
In this way, the value that pops up every time is 1;
Because we want to use the returned value Process and change status to its value, check some information
Solution: async:false,
rewritten as:
$.ajax({
async:false,
url:"{:U('Home/Index/checkemail')}",
data:"email=" query.email,
type:"post",
dataType:"json",
success:function(re){
status=0;
}
});
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