We are in the last chapter jquery Beginners Introductory example teaching two user registration (simple form verification) (/html/jqueryjiaocheng/200807/17-519.html)
There's a line of statements inside
$.get ("php/user_register.php", {act:$ (this). attr ("IDs"), v:$ (This). Val ()},function (TXT) {
msg.html (TXT);
})
This is a simple example of jquery ajax application
What is Ajax
Ajax is all called "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), a Web development technology that creates interactive Web applications.
If you are not very clear please refer to http://baike.baidu.com/view/1641.htm
Now let's look at jquery's support for Ajax.
First, let's talk about $.get.
$.get (URL, params, callback)
Request Mount Remote page with Get method
return value: XMLHttpRequest
Parameters:
- URL (String): The URL address where the page is loaded.
- params (MAP): (optional) key/value pair parameters sent to the server.
- Callback (function): (optional) functions that are executed when a remote page is loaded to completion.
Instance:
For example file Demo1 HTML code as follows
<a href= "javascript:void (0)" >demo</a>
<div id= "Show" style= "Border:solid 1px #FF6600" > added in Content:</div>
The get.html code is as follows
<strong>ajax Get content </strong>
Now I'm going to implement the click Demo to load the get.html content into the div.
<script language= "JavaScript" >
<!--
$ ("document"). Ready (function () {
$ ("a"). Click (function () {//div binding Sentinel Event
$.get ("get.html", function (data) {
$ ("#show"). HTML ($ ("#show"). HTML () + "<br>" +data);
})
})
})
-->
</SCRIPT>
If you need to take parameters only
$.get ("get.html", {parameter name 1: Parameter 1 value), parameter name 2: Parameter 2 value},function (data) {
$ ("#show"). HTML (data);
})
$.post (URL, params, callback)
mount a remote page in HTTP POST mode
return value: XMLHttpRequest
Parameters:
- URL (String): The URL address where the page is loaded.
- params (MAP): (optional) key/value pair parameters sent to the server.
- Callback (function): (optional) functions that are executed when data is loaded into completion.
About $.post Demo I'm not going to write it. and $.get exactly the same just one is get way request one is post mode request