Ajax is no longer a new topic, but jQuery makes ajax extremely simple. JQuery provides several ajax functions. They are similar in that they are separated to process different types of data. The simplest is get (url, parameters, callback). This function initiates a GET request and passes the data returned by the server to callback for processing. In the following example, an ajax request is initiated when the mouse is hovering over the hyperlink, and more about the hyperlink is returned from the server. First look at the server code, create a new ajaxload. ashx, as an example, get the query parameter value of word, and return:
The Code is as follows:
<% @ WebHandler Language = "C #" Class = "ajaxload" %>
Using System;
Using System. Web;
Public class ajaxload: IHttpHandler {
Public void ProcessRequest (HttpContext context ){
Context. Response. ContentType = "text/plain ";
String word = context. Request. Params ["word"];
Context. Response. Write (string. Format ("
More intorduction of {0} is here ....
", Word ));
}
Public bool IsReusable {
Get {
Return false;
}
}
}
The front-end code is as follows:
The Code is as follows:
Ajax Text