日期:2014-05-16 浏览次数:20353 次
<form action="xxx" method="post" onsubmit="return check__()">
function check__(){ var uid = $('#uid').val(); var pwd = $('#pwd').val(); var ys = false; $.getJSON('xxx', xxx,function(req){ if( req.success !=1 ) { //显示错误 } else { ys = true; //这里alert(ys)查看 为 true } }); return ys; }
function check__() { var uid = $('#uid').val(); var pwd = $('#pwd').val(); var ys = false; $.ajax({ url: 'xxx', data: 'xxx', type: 'GET',cache:false ,async:false///////////同步 , success: function () { if (req.success != 1) { //显示错误 } else { ys = true; //这里alert(ys)查看 为 true } } }); /*$.getJSON('xxx', xxx, function (req) { if (req.success != 1) { //显示错误 } else { ys = true; //这里alert(ys)查看 为 true } });*/ return ys; }