Experiences in Ajax asynchronous calling of methods with parameters in Web Services

Source: Internet
Author: User

I was very depressed last night. I encountered a problem that was not solved for one night. It was always unsuccessful when I used ajax to asynchronously call a web service with parameters, because the status value of XMLHttpRequest is never equal to 200. I thought I was using Ajax to call the Web service in a wrong way. I used to refer to a previously written method without parameters, and found that it was correct. I finally found the problem this morning (--# It often takes a lot of time for cainiao to solve a problem. You're not experienced !!).

I added this sentence before the send method.Code: XMLHTTP. setRequestHeader ('content-type', 'application/X-WWW-form-urlencoded'); it's okay... depressing... it seems that this sentence must be added to the method with parameters to asynchronously call the web service. Otherwise, XMLHTTP. status is not 200. then... that is, the processing function ''' cannot be executed ''''

This is my experience, and I hope it will help you. At least don't be tripped up by a minor problem when you are a beginner. Remember to stick ''''

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.