Example of ajax get () method usage in jQuery, jqueryajax
This document describes the ajax get () method in jQuery. Share it with you for your reference. The specific analysis is as follows:
$. Get () requests data from the server through http get requests.
Syntax structure:
Copy codeThe Code is as follows: $. get (url, [data], [callback], [type]);
Parameter Parsing:
1. URL: required, specifying the request URL.
2. data: (optional) Key/value parameter to be sent.
3. callback: (optional) callback function executed after the request is successful.
4. type: Optional. The returned content format is xml, html, script, json, text, and _ default.
Code example:
Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Meta name = "author" content = "http://www.bkjia.com/"/>
<Title> helping customers </title>
<Script type = "text/javascript" src = "mytest/jQuery/jquery-1.8.3.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Bt"). click (function (){
$. Get ("mytest/demo/antzone.txt", function (data, status ){
Alert ("Data:" + data + "\ nStatus:" + status );
})
})
})
</Script>
</Head>
<Body>
<Input type = "button" value = "view results" id = "bt"/>
</Body>
</Html>
I hope this article will help you with jQuery programming.