码迷,mamicode.com
首页 > Web开发 > 详细

Jquery异步

时间:2016-11-04 16:21:06      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:jquer   sys   bind   asm   ajax   and   content   text   pos   

一、Jquery向aspx页面请求数据
$("#Button1").bind("click", function () {
$.ajax({
type: "post",
url: "default.aspx",
data: "name=" + $("#Text1").val(),
success: function (result) {
alert(result.msg);
}
});
});
二、Jquery向WebService页面请求数据

一般页面需要在方法前面声明服务:[System.Web.Services.WebMethod]

$("#Button2").bind("click", function () {
$.ajax({
type: "post",
contentType: "application/json",
url: "WebService.asmx/HelloWorld",
data: "{name:‘" + $("#Text1").val() + "‘}",
datatype: "json",
success: function (result) {
alert(result.d);
}
});
});
三、Jquery向ashx请求数据和向页面相同
$("#Button3").bind("click", function () {
$.ajax({
type: "post",
url: "Handler.ashx",
data: "name=" + $("#Text1").val(),
success: function (result) {
alert(result.msg);
}
});
});

Jquery异步

标签:jquer   sys   bind   asm   ajax   and   content   text   pos   

原文地址:http://www.cnblogs.com/it-xcn/p/6030564.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!