The HTML5 AJAX 2.0 standard enhances many features of Ajax, including sending Formdata data, uploading data progress bars, and more. In practice, however, Ajax can send binary data in bytes.
Send binary data
var oreq = new XMLHttpRequest ();
Overriew:onreadystatechange is assigned a value by the callback function, it can implement the asynchronous call, the callback function directly manipulate the DOM, you can implement local refresh. So how does XMLHttpRequest onreadystatechange know
Creating XMLHTTP objects, distinguishing Ie,mozilla browsers
Copy Code code as follows:
function Getrequest () {
Http_request = false;
if (window. XMLHttpRequest) {
For browsers such as Mozilla﹑netscape﹑safari, create XMLHttpRequest
Sometimes, you need the server to actively push data to the browser, here with Ajax to achieve this function, specifically, see here:
var uid = "{$uid}";
var i = 0;
var timer; $ (). Ready (function () {//Open Sweep code login modal box $
I do the amber Unlimited level classification linkage menu JavaScript version, in the Blue Ideal and csdn published a bit, the plum blossom snow brother in Csdn put forward the problem of inefficiency, I also recognize this, this plan is completed
Today in the dream of the light of the blog saw an AJAX hack demonstration, in fact, across the station found very easy, but to do great harm or difficult, secretly cookies and what only for users, XSS worm that use is terrible.
Let's take a look
main functions:
Copy Code code as follows:
function GetObject (objectId) {
if (document.getElementById && document.getElementById (objectId)) {
The Consortium DOM
return document.getElementById (OBJECTID);
}
else if (document.all &&
Copy Code code as follows:
-----------------------------Jack's note ajaxjs.js-----------------------------
Here is a window to display a wait
document.write (' data is being read, please wait for ... ')
Showloading controls the display
A few months ago, I wrote the following three AJAX-related functions because of the project requirements. Publish it and share it with you.The first is used to load a section of HTML without refreshingThe second is to convert the form data into a
The $.post method using jquery can initiate an AJAX request to the server in post form. The $.post method is a practical tool for jquery.
The characteristics of post and get send way, get method submits data is unsafe, data is placed on request
Because of the popularity of jquery, it is now using jquery encapsulated Ajax, because the browser compatibility problem is solved, which is tantamount to the programmer to remove a heart scourge, but not native Ajax disappeared, and I feel that the
Servlet passes data string to foreground
The method used is
PrintWriter out = Response.getwriter ();
Response.sendredirect ("test.jsp");
String s = "[{' id ': ' 1 ', ' pId ': ' 0 ', ' name ': ' test1 '},{' id ': ' One ', ' pId ': ' 1
This article describes the Ajax asynchronous way to achieve login and verification of the detailed code, to share with you for your reference. Specifically as follows:
Login Code
This is implemented using the BOOTSTRAP3 component functionality.
JSON format in Ajax
HTML code:
PHP Code:
XML format in the second Ajax
HTML page:
PHP page code:
the request data sent by the loadxml ($user);
Var_dump ($doc);
How to build XML-compliant
The latest updates have been modified when the input component name is included []. The focus on the component will appear JS error, only IE is the case, did not find a good solution, I just to exclude this situation, that is, when the component
Because of the restriction of homology policy, JavaScript has the problem of cross-domain communication, and the typical cross-domain problem is the communication between IFRAME and parent. A few common solutions:
(1) Document.domain+iframe (2)
The first thing we need to use today is Ajax.NET Professional, where you can get information about ajax.net from http://www.schwarz-interactive.de/. Second, you need to know the relevant knowledge of XML data island.
Let's take a look at a simple
1,content-type
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 text/html is ordinary text.
Content-type Settings for
JSON and JSONP
Jsonp and JSON like, what's the connection between them?
JSON (JavaScript Object notation) is a lightweight data interchange format. For the JSON everyone should be very familiar with it, not very clear friends can go to the
Jtemplate is a jquery based template engine plug-in, the function is very powerful, with her you will no longer have to use JS binding data sets and worry about.
Main idea, copy textarea as template, Ajax load JSON data, add templates, bind data,
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