首页 > 编程 > .NET > 正文

ASP.NET中Ajax怎么使用

2024-07-10 12:53:45
字体:
来源:转载
供稿:网友

有时,当我们越想了解一个知识,越觉得自己很无知,但是在这之前,你知道一个或两个的片面观点吗?其实Ajax有很多优点,下面是错新技术频道小编分享的ASP.NET中Ajax怎么使用,一起来看看吧!

在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怎么使用,是否了解了呢?欢迎您在评论部分发表评论,错新技术频道小编认为这是个不错的文章。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表