Let's take a look at an official example.
Instance
Use AJAX requests to get JSON data and output the results:
The code is as follows
Copy Code
$ ("button"). Click (function () {$.getjson ("Demo_ajax_json.js", function (
Example send POST data and obtain returned results Garbled data submitted by ajax postThe tests in firefox are normal, and both chrome and ie kernel have this problem,When the page attribute is set to UTF-8, only firefox is the character set = UTF-8
The code is as follows
Copy Code
ajax User Registration Inspectionajax User Registration Verification Method=post> username:Name= "username" >*email:* Password:Onkeyup= "Checkintensity (this.value)" type= "password" name= "password"
New station's message board added a penthouse function, do not know you have used it?
In the beginning, I did not appear in the test when the problem, the specific questions below analysis, here first grumble.
Tonight, idle boring, and thinking
For example, the following iplaysoft in this section of the site.
You can also first look at what I do a little
The code is as follows
Copy Code
ajax load
Click each tab to convert to see the different
Cors just can solve the problem.
Compared with JSONP, Cors is no doubt more advanced, convenient and reliable.
1. Jsonp can only implement get requests , while Cors supports all types of HTTP requests.
For example, if you need to obtain data from
Using JQuery will make Ajax as simple as it gets. JQuery provides a number of functions that make simple work easier, and complex work becomes less complex.
The most common use of Ajax is to load a piece of HTML code into an area of the page. To do
Often used to jquery+ajax/"target=" _blank >jquery Ajax, but sometimes forget how to write, take a note below. jquery Ajax Example:
The code is as follows
Copy Code
Post method $.ajax ({ URL: ' test.php ', Type: ' Post ',
The full format of the call load method is: Load (URL, [data], [callback]), where
URL: Refers to the address of the file to be imported.Data: Optional parameters, because load can not only import static HTML files, but also import dynamic scripts,
The full format of the Load method is: Load (URL, [data], [callback]),
which
URL: Refers to the address of the file to be imported.data: Optional parameters; Because load can not only import static HTML files, but also import dynamic scripts, such
jquery Ajax loading XML documents
Method Two
Many times the inability to parse is the content-type problem. If you are an XML file, skip this step.Dynamically generated XML must be set to Text/xml, otherwise the default is
Json Ajax without refreshing paginationIn this article, I will go on to write a new page without refreshing the effect of reading data using json and binding with the page splitter.// Read data based on the current pageFunction BindCommentList (page
Html code The code is as follows:Copy code Customer Information: Name: , Mobile phone: customer name: "/> customer's phone number: "/> customer gender: Female male Unknown enter the broker ID: & Lt; td width = "86%" & gt; "/>
The most commonly used jquery + ajax method is $. post, which is a second encapsulation of $. ajax. Next let's take a look at the use of $. ajxa: The code is as follows:Copy code $ ('# Ajax'). click (function (){$. Ajax ({Type: 'post ',Url:
Enter Baidu to search for the problem and find someone saying thisThe default value of async in Ajax in Jquery is true (asynchronous request). If you want to execute another Ajax after Ajax is executed, you need to set async to false.At that time, I
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.