<!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> 请输入员工编号: <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("出现错误:" + data.msg); } }, error: function (jqXHR) { alert("发生错误:" + jqXHR.status); } }) }); </script></body></html>服务器端取出来的数据:{"success":ture,"msg":"[员工编号:101] [员工姓名:王小二] [员工职务:工程师]"}
添加回答
举报
0/150
提交
取消