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
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
Usually jquery's submit form submission is not intercepted, but the asynchronous submission with jquery Ajax is rejected, and since the problem is caused by an asynchronous commit, it's a good solution because the jquery Ajax method provides the
The title, Imitation Sina Weibo home page scrolling effect written a jquery plugin.Just began to practice writing Jquyer plug-ins, not very skilled, make up with the first.The code is as follows:
The code is as follows
Copy Code
var info = document.getElementById ("TXT"). Value;
Jquery.ajax ({
Type: ' Get ',
URL: ' http://localhost:8080/jdom/hehe.do?act= page special effects on ',
Data: "&info=" +info,
Cache:false,
DataType: ' JSON ',//Specifying return type
Ajax in a variety of browsers to achieve a perfect cross-domain needs with the help of JSONP technology, JSONP Essence is to request a JS script file, in the JS file load completed when a function, so you can perfect the rule cross-domain problem.
Cases
The code is as follows
Copy Code
var ajax = function () {};Ajax.prototype = {Request:function (method, URL, callback, Postvars) {var xhr = This.createxhrobject ();Xhr.onreadystatechange = function () {if
Yesterday encountered a problem such as:
IE Browser, Web site can not log on and exit normally.
That's weird. The previous comparison ignores ie. Using Firefox google test is good.
After repeated investigation, finally found the problem.
I am
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
A UTF8 page requires post data to the GB2312 page, when the Chinese encoding is submitted in accordance with the UTF8, GB2312 the page can not receive. How to achieve, the network search a very good way, but there is a flaw, here one.
1, the form
The Async:false of jquery, this attributeThe default is true: Asynchronous, false: Sync.
The code is as follows
Copy Code
$.ajax ({ Type: "POST", URL: "Path", cache:false,
Spent three head, repeatedly check, found that the original is changed processing page return header information.With the Application/x-javascript, IE8 no work.If it is text/html, it is OK, or it is not specified.Is it a bug? Let me say hello to the
Ajax. innerHTML Processing
JavaScript code Analysis
First of all, this needs to be sent three times, so we write the reusable code into a function, the task of which is to set the XMLHttpRequest object and initialize the necessary attributes. The
In JQuery 1.2, you can load JSON data for other domains, such as "myurl?callback=?", by using a callback function in JSONP form. Will jQuery be replaced automatically? To the correct function name to execute the callback function. Note: The code
The content of ajaxtest.htm on the front page is as follows: The code is as follows:Copy code This Page interacts with the background in different ways Set up a Handler. ashx page in the background as follows: The code is as follows:Copy
Tip: you can modify some code before running : Ajax loading effect code :: Loading... Chargement de la page termin ?.. Tip: you can modify some code before running
Baidu and Google seem to have been doing this for many years. I thought it was easy to find code on the Internet to achieve this effect. We can't find this requirement. Therefore, I wrote this result by myself. Because I integrated the effect into
Several ajax requests in jquery, including the underlying method $. ajax (), Layer 2 load (), $. post (), $. ajax (), Layer 3 $. getJSON (), $. getScript (). The code is as follows:Copy code
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