Using jquery's Ajax technology, you can easily implement partial page refreshing and backend parameter passing.The basic usage is as follows:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<SCRIPT type = "text/JavaScript" src = "jquery. js"> </SCRIPT>
<SCRIPT>
$ (Function (){
$ ("# Clickme"). Click (function (){
$. Ajax ({
URL: "backend processing page, which can be a page such as PHP/asp/. Net/JSP/Action/or Program ",
Type: "Post ",
Datatype: 'json ',
Data: {Parameter Name: parameter value, parameter name: parameter value ,...},
Success: showresult // note that there is no comma at the end of the last parameter. Success refers to the work to be done on the current page after the background action is completed. It is usually to call another function to report the result to the user.
});
});
})
Function showresult (data) // The parameter data here is used to receive the result returned by the background processing program.
{
$ ("# Result" ).html (data) // asynchronously loads the received feedback results to the elements on the current page.
}
</SCRIPT>
</Head>
<Body>
In this example, after you click the "load content" button, the current page will submit the parameters to the corresponding processing program in the background to receive feedback from the background processing program, and displayed on the current page. The user stays on the current page. <Br/>
<Input type = "button" id = "clickme" value = "load content">
<Div id = "result"> the content is empty. </Div>
</Body>
</Html>