Ajax Series 4: problem summary, ajax series Summary

Source: Internet
Author: User

Ajax Series 4: problem summary, ajax series Summary

1. the most classic problem is the cache problem in ie. 
If get is used, a cache problem occurs in ie. The code is executed only once. The solution is to add a timestamp or random number to make the url unique so that no ie
Or change to post for submission.
Xhr. open ("get", "xxxx. aspx? _ Dc = "+ newDate (). getTime (), true );

2. Case sensitivity of ajax Object Attributes
The w3c browser, such as ff, is case sensitive. For example
If (xhr. readystate = 4) is true in ie, but it won't work in ff because ie is case insensitive and ff is case sensitive.
The standard format is if (xhr. readyState = 4). Similarly, there are attributes responseText, responseXML, and status.
Also, the status conversion function xhr. onreadystatechange must be in lowercase.

3. ajax status 0 
In some cases, xhr. status = 200 is added to test the ajax code and the code of xhr. status = 200 is not executed, so pay attention to this.
Xhr. status = 200 is to be browsed through the server, and the server page does not have an error or returns the 200 status only when it is switched, this status is consistent with the status defined by the server when you access the page through a browser.
Drag the browser directly to view the result or double-click the html page to run it. If no error occurs, xhr. status is 0, not 200.
Therefore, you can add an xhr. status = 0. As follows:

Copy codeThe Code is as follows:


If (xhr. status = 200 | xhr. status = 0 ){
Alert ('OK ');
}


Another problem occurs when you drag the browser to view the result or double-click the html page. If you are requesting an xml file, you must use the responseXML attribute to return the xmlDom, however, the xmlDom attribute cannot be returned in ie. The solution is as follows.
4. responseXML problems. 
To use the responseXML attribute, the request is an xml file or a dynamic page with the response header set to "text/xml. Note that if a dynamic page is requested, do not forget to set contenttype to "text/xml "!!!!!!!! Remember ~~~~~~
Asp is response. contenttype = "text/html"
Asp.net is Response. ContentType = "text/html ";
Php is the header ("content-type: text/xml ;");
If there is a problem in ie, when you drag it directly into the browser or double-click to run the html preview effect, even if the requested xml file, the xmldom cannot be returned using responseXML.
You will know after testing, as shown below:
Showbo. xml

Copy codeThe Code is as follows:


<Showbo>
<Item> 1 item>
<Item> 2 item>
<Item> 3 item>
<Item> 4 item>
</Showbo>


Test.html

Copy codeThe Code is as follows:


Function getajax (){
If (window. XMLHttpRequest) return new XMLHttpRequest ();
Else if (window. ActiveXObject) return newActiveXObject ("microsoft. xmlhttp ");
}
Var xhr = getajax ();
Xhr. onreadystatechange = function (){
If (xhr. readyState = 4 ){
If (xhr. status = 200 | xhr. status = 0 ){
Var doc = xhr. responseXML, item = doc. getElementsByTagName ("item ");
Alert (item. length); // output in ie is 0, and output in ff is 4. The xml tree structure does not appear to be generated in ie. The specific reason is ms ..
}
Else alert ('error \ n \ n' + xhr. status );
}
}
Xhr. open ("get", "showbo. xml? _ Dc = "+ newDate (). getTime (), true );
Xhr. send (null );


The solution is to use the microsoft. xmldom object to recreate the xml tree structure, as shown below:

Copy codeThe Code is as follows:


Xhr. onreadystatechange = function (){
If (xhr. readyState = 4 ){
If (xhr. status = 200 | xhr. status = 0 ){
Var doc = xhr. responseXML;
If (document. all & xhr. status = 0) {// restructured the xml tree structure when ie is directly inserted into the browser.
Doc = new ActiveXObject ("microsoft. xmldom ");
Doc. loadXML (xhr. responseText );
Doc=doc.doc umentElement;
}
Var item = doc. getElementsByTagName ("item ");
Alert (item. length );
}
Else alert ('error \ n \ n' + xhr. status );
}
}


5. Note the following when submitting a post request.
When submitting a post request, you must set content-type to "application/x-www-form-urlencoded" so that you can use request/request on a dynamic page. form/request. the querystring object obtains the value through the key. Otherwise, the binary data must be used. Then, you can analyze the binary data to generate a String object and obtain the corresponding value using the regular expression.


Conclusion

This article mainly describes the work content, achievements, and deficiencies, and finally proposes reasonable suggestions or new efforts ......
Reprinted: In summary, we conduct a comprehensive and systematic overall check, overall evaluation, overall analysis, and overall research for a period of time, and analyze the scores, deficiencies, and experiences. The conclusion is a kind of application writing and a rational reflection on the work that has already been done. Summaries and plans complement each other, and should be based on plans. Plans should always be prepared based on personal experiences.
Summary of basic requirements
1. The summary must have an overview and description of the situation, some of which are relatively simple and some are relatively detailed. This part mainly analyzes the subjective and objective conditions, favorable and unfavorable conditions, and the work environment and basis.
2. Scores and shortcomings. This is the summary center. The purpose of the summary is to confirm the score and find out the shortcomings. What are the scores, what are the scores, what are the manifestations, and how they are achieved? What are the shortcomings, what are the manifestations, what is the nature, and how they are generated.
3. Experience and lessons learned. I have always had experience and lessons when I did one thing. In order to facilitate future work, it is necessary to analyze, research, generalize, and concentrate the experience and lessons learned from past work, and raise the knowledge to the theoretical level.
Future plans. Based on future work tasks and requirements, learn from the work experience and lessons of the previous period, clarify the direction of efforts, and propose improvement measures.
Summary Notes
1. Be sure to seek truth from facts, do not exaggerate the score, do not narrow down the shortcomings, and do not resort to fraud. This is the basis for analysis and lessons learned.
2. The Organization should be clear. The summary is written to people. If the organization is unclear, people will not be able to read it. Even if they read it, they will not be able to do so.
3. You need to properly tailor the settings and make them more appropriate. Materials are essential and relevant; they are important and secondary. They should be refined during writing. The problems in the summary should be classified into primary and secondary, detailed, and detailed.
Basic Summary Format
1. Title
2. Text
Start with: Overview, overall evaluation, outline and outline.
Subject: analyze the score defects and summarize lessons learned.
End: analyze the problem and clarify the direction.
3. Payment signature, date

How to sum up the four arguments ??????

First of all, you should reiterate your point of view on this issue, make a necessary summary and debate on the vulnerabilities pointed out by the other party, and then make a simple comment on the other party's point of view.

Debate skills

The original intention of the customer is to turn the guests into masters. The metaphor changes from passive to active. In the debate, passive is a common weakness in the field and a precursor to defeat. In the debate, the anti-customer is dominant. In other words, it is to change passive to active in the debate. Next, we will try to use the technical theory and the analysis of actual cases to introduce several anti-customer skills.

(1) leverage the power

In martial arts novels, there is a trick called "force-pushing", which means that a person with deep internal force can attack the other party to counter the other party. This method can also be applied to arguments.

For example, in the debate on "difficult to know", there is such a round:

Fang: Yes! It is precisely because those who die on the Criminal Court that they know the power of the law. The dignity of the law can be described as "difficult! (Applause)

When the other party argues that "the law is easy to abide by the law and the law" is difficult to comply with the law, the square will immediately turn to "The law is not easy" to strengthen their views, give the other party a powerful counterattack. This has reversed the passive situation.

Here, the reason why Fang can use the reverse example to reverse his body is that he has a series of theories that are not verbal and re-interpreting words as a strong backing: "Zhi" in the debate ", it is not just "know ". it should also be "Knowledge" based on human rationality. It is not difficult to abide by laws. As a behavior process, it is not difficult to kill people, but we must understand how to maintain human rationality, it is difficult to restrain the heart from developing a vicious desire to kill people. In this way, the broad and high-level definitions of the square "Zhiyi" and "Xing Yi" refer to the narrow and low-level definitions of the square "Zhiyi" and "Xing Nan... The attack force effectively defended back against the reverse, causing the reverse's theoretical framework to collapse on the "knowledge" and "line" superficial aspects.

(2) flowers and trees

Remove the defective parts of the other party's arguments and replace them with our favorable points or materials. We often receive the miraculous effect of "getting two hundred thousand pounds. We call this technique "Garden of flowers and trees ".

For example:

The opposite side: the ancients said that "Shu is difficult, but it is difficult to go to Qingtian". It means "Shu Dao is difficult to go, and" go "is" OK! If it is difficult, why is Sun Walker not called Sun zhizhe?

Fang: Sun dasheng's nickname is Sun Walker, but does the other party's debating friends know that his legal name is Sun Wukong, and "Wu" is "Zhi "?

This is an example of a very beautiful "Landscape. The example of the opposition seems to be concise, but in fact it is somewhat far-fetched: It is difficult to refute the question of "why Sun Walker is not called Sun zhizhe". Although it is a kind of initiative that is close to strong words, after all, it has gained the upper hand in momentum. Fang keenly discovered the one-sidedness of the opponent's arguments, and resolutely started from the "Sun Wukong" side to "Wu" is "Zhi" to oppose each other, enable the other party to quote "Sun dasheng" to save fire and make trouble.

The technique of moving flowers and trees is a strong attack in the debate theory. It requires the debater to have the courage to answer tricks and fight back. Therefore, it is difficult and highly resistant. Strong persuasive argument skills. It is true that there are no readily available materials such as "Sun Walker" and "Sun Wukong" on the scene. That is to say, there are more "flowers and trees ". It is necessary for the debater to make a precise induction or deduction of the current views and positions of the other party.

For example, in the full text about & quo...>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.