jquery Loop Statement If-else If-else
Callbackfun () function, beginning is written if-if-else. The result is that the first if there is no match, it will be judged again,
If the second if is matched, the statement in the second if is executed, and the statement in else is executed if there is no match to the second if.
function Checkkey () {
var url = ' ${ctx}/pos/pos!validateimei.do ';
var params = {imei:$ (' #imei '). attr (' value ')};
/**$ (' #warn '). HTML ("The IMEI number does not exist, please re-enter it.") ");*/
Jquery.post (URL, params, callbackfun);
}
function Callbackfun (data) {
if (data== ' yes ') {
/**$ (' #warn '). HTML (data);
$ (' #warn '). HTML ("the IMEI number exists.") ");
}else if (data== ' no ') {
/**$ (' #warn '). HTML (data);
$ (' #warn '). HTML ("The IMEI does not exist, please re-enter it.") ");
}else{
$ (' #warn '). HTML ("Unknown error.") ");
}
/**$ (' #warn '). HTML (data);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.