function checkCode(code){ $.ajax({ url: ‘/admin/WebService1.asmx/CheckVerifyImage‘, type: ‘POST‘, dataType:"xml", data:{code:code}, <span style="color: #FF0000;">async:false,</span> success: function(msg){ isCodeRight=msg.text; }, error: function(x, e) { alert(x.responseText); return false; }});}async:false即可(jquery适用)原文:http://www.cnblogs.com/aneo/p/4150687.html