1 回答

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超4個(gè)贊
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | $(function (){ $("#submit").click(function (){ var username=$("#username").val() $.ajax({ type: "get", url:"post.asp", async: true, timeout: 15000, data:{username:username}, beforeSend: function(xhr) { //beforeSend定義全局變量 xhr.setRequestHeader("If-Modified-Since", "0"); //If-Modified-Since HTTP請(qǐng)求頭標(biāo)簽,即比較瀏覽器緩存頁(yè)面時(shí)間 }, success: function(xmlDoc, textStatus, xhr) { if(xhr.readyState==4) { if(xhr.status == 200) { var str=xhr.responseText; //獲取返回值 if (str==0){ //查詢返回0表示已注冊(cè) alert("已被注冊(cè)") return; } else{ //運(yùn)行正確的代碼 alert("可以正常注冊(cè)") } } } }, }); }); }); |
- 1 回答
- 0 關(guān)注
- 502 瀏覽
添加回答
舉報(bào)