<!DOCTYPE html><html><head>? ? <meta http-equiv="Content-type" content="application/json; charset=utf-8" />? ? <title></title>? ? <script src="js/jquery.js"></script>? ? <style>body,input,select,button,h1{font-size:30px;}? ? </style></head><body>? 請(qǐng)輸入員工編號(hào): ?<input id="Number" type="text" /><input id="Button1" type="button" value="查詢" />? ? <p id="searchID"></p>? ?? ? <script>? ? ? ? $("#Button1").on('click', function () {? ? ? ? ? ? $.ajax({? ? ? ? ? ? ? ? type: "GET",? ? ? ? ? ? ? ? url: "ajax.aspx?N=0&Number=" + $('#Number').val(),? ? ? ? ? ? ? ? dataType: "jsonp",? ? ? ? ? ? ? ? jsonp: "callback",? ? ? ? ? ? ? ? success: function (data) {? ? ?? ? ? ? ? ? ? ?if (data.success) {? ? ? ? ? ? ? ? ? ? $("#searchID").html(data.msg);? ? ? ? ? ? ? ? ? ? } else {? ? ? ? ? ? ? ? ? ? $("#searchID").html("出現(xiàn)錯(cuò)誤:" + data.msg);? ? ? ? ? ? ? ? ? ? } ?? ? ? ? ? ? ? ? },? ? ? ? ? ? ? ? error: function (jqXHR) {? ? ? ? ? ? ? ? ? ? alert("發(fā)生錯(cuò)誤:" + jqXHR.status);? ? ? ? ? ? ? ? }? ? ? ? ? ? })? ? ? ? });? ? ? ? ?</script></body></html>服務(wù)器端取出來(lái)的數(shù)據(jù):{"success":ture,"msg":"[員工編號(hào):101] [員工姓名:王小二] [員工職務(wù):工程師]"}
為什么這樣執(zhí)行會(huì)提示200的錯(cuò)誤,瀏覽器查看服務(wù)器數(shù)據(jù)也取出來(lái)了。
慕碼人5298297
2017-07-13 17:58:08