文件名称:jquery 异步请求数据的三种方式
文件大小:58KB
文件格式:RAR
更新时间:2014-01-08 19:14:18
jquery 异步请求数据
$('#send_ajax').click(function () { var params = $('input').serialize(); //序列化表单的值 $.ajax({ type: "POST", contentType: "application/json;charset=utf-8", url: "WebServicetest.asmx/HelloWorld", data: "{username:'cccc'}", dataType: "json", success: function (data) { alert(data); alert(data.d); var json = null; json = eval('(' + data.d + ')') alert(json.username); }, beforeSend: function(x) { x.setRequestHeader("Content-Type", "application/json; charset=utf-8"); }, error: function(x, e) { alert(x.responseText); }, complete: function(x) { alert(x.responseText); } }); });
【文件预览】:
css
----jqModal.css(1KB)
App_Code
----WebServicetest.cs(2KB)
ajax.suo
Web.config
jmodel.aspx
ajax.htm
WebServicetest.asmx
Default.aspx
Default.aspx.cs
js
----jquery-1.4.4.js(179KB)
----jqModal.js(3KB)
jmodel.aspx.cs