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

ASP.NET中Ajax的用法

时间:2016-07-11 16:34:46      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

  在ASP.NET中应用Ajax的格式如下:

前台代码(用JQuery库)

$.ajax({

  type: "POST",

  async: true,

  url: "../Ajax/ajax.ashx",

  dataType: "html",

  data: null

  success: function (result)

  {

  //do successful sth

  },

  error: function (XMLHttpRequest, textStaus, errThrown)

  {

  //do error sth

  }

})

Ajax(一般性处理程序)中代码如下:

 

public void ProcessRequest (HttpContext context)
{
context.Response.ContentType = "text/plain";
string result = "Hello World";
context.Response.Write(result);
}

 

ASP.NET中Ajax的用法

标签:

原文地址:http://www.cnblogs.com/ABblog/p/5660454.html

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