The advent of AJAX technology has greatly improved the user experience of Web projects, and it is now easy to implement a variety of features based on Ajax technology with a good jQuery framework. Let's take a look at the following excellent paging
Later in a humble station to find a post, a person's a suggestion to remind me.
My original code was written like this:
Error code
Copy Code code as follows:
$.ajax ({
Type: "Post",
URL: "_service.asmx/getdatafromatable",
Data:
Copy Code code as follows:
var parambeanlist = new Array ();
Array.prototype.addparambean=function (parambeanobj) {
var index = This.containparambean (parambeanobj);
if (index!=-1) {
This[index] = parambeanobj;
} else {
This.push
Hi, two today, do something, ah, remember, just the first two days have been learning Ajax-related knowledge, and then learn about jquery and Ajax related knowledge.
1, JQuery
-----jquery and Ajax-----
Ajax, "Asynchronous JavaScript and XML"
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
In jquery, there are three ways to implement Ajax: $.ajax (), $.post, $.get ().
First we look at $.get ():
Copy Code code as follows:
$.get ("test.jsp",
{name: ' Cssrain ', Time: ' 2008/01/21 '},//data to be passed
function (data)
In doing Ajax pages without refreshing add, ie encounter ajax cache, because the beginning does not know IE has this bad, toss for a long time, finally solve the problem.
summarize the solution :
Using AJAX to request a page under IE, usually
Copy Code code as follows:
Ajax File Downloads
jquery.download = function (URL, data, method) {
Get URL and data
if (URL && data) {
Data is string or Array/object
data = typeof data = = ' String '? Data:jQuery.param (data);
Another form of the linkage box, the right-hand side of the linkage is generated with jquery
This is modeled on the JS method of the article modified
First look at the page code:
Copy Code code as follows:
Area:
Do not want to use the style of Easyui, but want his form function, originally was to go to the Internet to find relevant plug-ins, but did not find it began to write their own, did not think so simple.
Background code: (This is not important)
Let's first enumerate AJAX implementations in jquery and prototype.
Jquery:
Copy Code code as follows:
Prototype
Copy Code code as follows:
The actual introduction of the SetInterval function after
Copy Code code as follows:
/**
* Form submission Verification
**/
function OnSubmit () {
if ($ (' #name '). Val (). lengthAlert ("Name please not less than two characters");
return false;
}
var t = new Date (). GetTime ();
$.ajax ({
Copy Code code as follows:
var result = unescape (Xmlhttp.responsetext);
var j = eval ("(+ result +)");
Do not use var j = eval (result);
JSON (JavaScript Object notation) is a simple data format that is lighter than XML. JSON is the
Ajax code Landing is a milestone in the construction of a team framework, which enables the framework to have a version that can be applied for debugging. This is mainly thought of in the AJAX Framework code:
Framework Compatibility
The following is a processing function for encapsulation, which is also very convenient to use:
The name of the file is named: JQuery.ajaxRequest.js.
How to use:
Copy Code code as follows:
$ ('. _ajax '). Click (function () {
The AJAX request for jquery is the default request cache is true, which is turned on, and defaults to False when datatype is script and JSONP. Now I want to read the cache in the browser, because the AJAX request data is very large, request once is
Copy Code code as follows:
$.ajax ({
URL: ' This address should be replaced by your own ',
Data: {S_courseid:courseid, Currtime:new Date (). GetTime ()},//Add a timestamp, otherwise it will not automatically update
DataType: ' JSON ',
X-requested-with is often used to determine whether an AJAX request
But sometimes we have to remove X-requested-with.
The following describes a way JS code
Copy Code code as follows:
$.ajax ({
URL: ' http://www.zhangruifeng.com ',
Let me just briefly talk about the implementation process:
1. Find the link source, I am here is a string of li under the link
2. Processing style
3. When the mouse moves to load the site of the link source to the specified container, and toggle
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