Difficult to debug Ajax

Source: Internet
Author: User

Some time ago, I planned to improve the unfinished online examination system. I looked at the original system and thought that I should log on from the examinee. This part of xueyu has already been implemented through Ajax technology, so what I need to do is to continue to improve.

This part is new to use. Originally, JavaScript was not actually used for asynchronous communication, so it was not so clear at the beginning, with this classification, other people already have the idea of implementation and have achieved more than half of it. So while getting familiar with the code, I tried to guess her ideas.

After the code is almost viewed, the idea is gradually understood and the work will be improved. At this time, I knew the problem was just getting started. The point was that the Javascript seemed to be not executable. I changed it to the left, right, and guessed it again. I finally figured out why I couldn't execute it. It turns out that a place in the vast JavaScript code is not enclosed by quotation marks when passing real parameters. This will lead the compiler to think that it is a variable, but it is actually a constant. In addition, JavaScript does not have any exception prompts. This problem cannot be captured.

This problem is solved, and the system can also run, but there is another problem: After data is transmitted to the backend service through XMLHTTP, the XMLHTTP status readystatus is always 1, this indicates that "the object has been created and the send method has not been called". It is said that this is because the open method is XMLHTTP. open ("get", URL, true), where "true" indicates Asynchronization and can be changed to "false. However, it still does not work after the test. The current value is constantly generated by alert every attempt. This problem has not been solved yet. You can help us think about it.

I used alert and write methods to debug Javascript. I don't know how to use them.

Related Article

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.