jquery Ajax Get detailed descriptions and examples

Source: Internet
Author: User
Tags php code php tutorial

<script language= "Web Effects" src= "Jquery-1.4.2.min.js" ></SCRIPT>
<script language= "JavaScript"
$ (function () {////ajax code area
});
</script>
<body>
<input id= forasp Tutorial "type=" text "Maxlength=" > <input type= "button"   value= "Ajax test for jquery" Id= "cn"
<span id= "Backurl" > Www.forasp.cn</span>
</body>
the $.ajax (options) is used to implement Jqueryajax. The submission is set in type, and this Ajax is directly marked with a get way to submit the data.
(1) Syntax: $.get (Url,data,fun,type); The
URL represents the page on which the AJAX call
Date is passed by the Get method, data format {Data:value,data:value.} Optional
Fun is a callback function, function (msg), and MSG is the page return content. Optional
Type returns the content format, XML, HTML, script, JSON, text, and _default. Optional
Instance:
$ ("#cn"). Bind ("click", Function () {
$.get (index4.php tutorial, {foraspcnurl:$ ("#forasp"). Val ()}, Function (msg) {alert (msg);});
}); The call page in the
example is index4.php code as follows: <?echo $_get["Foraspcnurl"];? ".

Jquery.get (URL, [data], [Callback (data, Textstatus, XMLHttpRequest)], [datatype])

Returns:xmlhttprequest

URL string that contains the URL of the request being sent.

The data map or string is sent to the server with the request.

Callback (data, Textstatus, XMLHttpRequest) If the request is successfully executed.

Datatypethe type of data is expected from the server.

This is an abbreviated AJAX feature, which is equivalent to:

$.ajax ({
Url:url,
Data:data,
Success:success,
Datatype:datatype
});


The tuning function successfully returns data passing, which will be an XML root element, a text string, a Web effects file, or a JSON object based on the MIME type of the response. It also passes the response text state.

In jquery 1.4, the successful callback function is also passed through the XMLHttpRequest object.

Most implementations will specify a successful handler:

$.get (' ajax/test.html ', function (data) {
$ ('. Result '). HTML (data);
Alert (' Load was performed. ');
});


For more details please see: http://www.111cn.net/wy/jquery/35462.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.