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 (
About Ajax Cross-domain problem, sorted out today, in fact, there are other ways, personally recommended the following 4 kinds. Please refer to: Ajax cross-domain instanceOne, the traditional Ajax method
1,js Code
$ ("#ajax"). Click (function () {$
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
Tables can be built on their own, only classid,title,content,updatetime,id five fields
Home index.php
The code is as follows
Copy Code
www.corange.cn "name=" ClassID "id=" ClassID "/>Title:Content:
ok.php
Example 1. jquery+ajax/"target=" _blank ">jquery Ajax sync Way
The code is as follows
Copy Code
$.ajax ({URL: ' test.php ',Type: ' Post ',Async:false,//Using synchronous method, True is asynchronousData: {' act ': '
JSON (JavaScript Object notation) is a lightweight data interchange format. JSON stores data that is structured as "key-value." Sometimes we need to read JSON-formatted data files, which can be implemented in jquery using Ajax or $.getjson ()
Preson.js File Contents
The code is as follows
Copy Code
[{' Name ': ' Xiangwen '},{' Name ': ' Mengjie '}]XMLHttpRequest
-json-ajax:[support IE7 above]
The code is as follows
Copy Code
Jquery.post (URL, [data], [callback], [type])
Load information through a remote HTTP POST request and use Post to make asynchronous requests.
This is a simple POST request function to replace the complex $.ajax. Callback functions can be invoked
jquery Ajax Application Instance code/*Ajax sends data to a page$.post (' save.cgi ', {Text: ' My string ',Number:23}, function () {Alert (' Your data has been saved. ');});
If you do need to write some complex Ajax scripts, you need to use the
Ajax more focused on the front page asynchronous display of the Background database field, the main idea is similar to the previous article, focusing on the DAL layer to get stored in the process of the table collection dataset, in general stored
The Simple new
First you need to create a new variable and assign it a XMLHttpRequest object instance. This is simple in JavaScript, as long as you use the New keyword for the object name, as shown in Listing 1.
Listing 1. Create a new
This is a community arrangement of a holiday small homework, I just put forward my own solution, not necessarily the most appropriate.
The effect is roughly as follows:
Photo sharing:
This piece of
Ajax and ScriptManager. RegisterStartupScriptThe method for running a js code segment in Ajax and cs can be:Page. ClientScript. RegisterStartupScript (Page. GetType (), "", " ");If Ajax is used on the page, the above code is ineffective even if
Ajax framework autocompleteextender for automatic completionIf I need a WebService, I am too lazy to rename it. It is called WebService. asmx. Why do I need WebService? In fact, I don't know. I only know that AutoCompleteExtender requires three key
First, you must create a website to create the following files: Web forms (Default. asp tutorial x), JScript File (ajax. js), Web service (SayHelloService. asmx), Class (Hello. cs)(Add: you need to add a Microsoft. Web. Preview. dll file to download
We have always used the string sharding method to process the data returned by AJAX. Today, baidu finds that eval () can be used.For example: eval (http_request.responseText );Eval () functionJavaScript has many tips to make programming easier.One
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