在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使用方法的相關知識,希望對大家有所幫助,如果大家想了解更多內容,敬請關注VeVb武林網網站!
新聞熱點
疑難解答
圖片精選