Use jquery's Ajax method to call WebService

Source: Internet
Author: User
Tags sendmsg

The difference between calling WebService using jquery Ajax and calling WebService using pure JS Ajax is that

The former can run normally on IE, chrome, and Firefox, while the latter can only run normally on IE, and the former has pure cross-origin access problems.

1. Create a web project named cxf_javasclient, and paste the client code generated by calling the WebService Service using spring method into the new project,

Export the cxf core jar package to the Lin directory.

2. Import the jquery JAR File

32.16jquery_ws.html

Create a new HTML file named jquery_ws.html under webroot. the code is as follows:

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en"> <HTML> 

4. Deploy the cxf_rjclient to Tomcat.

5. Enter http: // localhost: 8080/cxf_javasclient/jquery_ws.html in the address bar for testing.

The following is an illustration of jquery's cross-origin access problem:

 

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.