Cordova cors Request for SMP resource failed

Source: Internet
Author: User
Tags json

Code:

    Test1:function () {
        $.ajax ({
            type: "GET",
            cache:false,
            URL: "Http://smp.springworks.info:8081/app1 /test/index2.jsp ",
            beforesend:function (Request) {

            },

            success:function (data, ajaxoptions, XHR) {
                Mymodules. Module1.debug ("READ SUCCESS");
                Alert (data)
            ,
            error:function (XHR, ajaxoptions, thrownerror) {
                mymodules. Module1.debug ("READ FAILED");
                Alert (Json.stringify (XHR));
                Alert (Json.stringify (ajaxoptions));
                Alert (Json.stringify (Thrownerror));
            }
        );

    

Wireshark Monitoring log:

iget/app1/test/index2.jsp?_=1476917522183 http/1.1
host:www.mdm.springworks.info:8081
Connection: Keep-alive
Accept: */*
origin:file://
user-agent:mozilla/5.0 (Linux; Android 5.0.2; REDMI Note 3 build/lrx22g; WV) applewebkit/537.36 (khtml, like Gecko) version/4.0 chrome/45.0.2454.95 Mobile safari/537.36
accept-encoding: gzip, deflate
accept-language:zh-cn,en-us;q=0.8
x-requested-with:com.mycompany.logon

http/1.1 403 Forbidden
content-type:text/html;charset=utf-8
content-language:en
content-length:1009
Date : Wed, Oct 22:52:01 GMT
Server:sap

=========================
Code:

    Test1:function () {
        $.ajax ({
            headers: {
                ' x-smp-appcid ': "C940cb2f-fef4-49d3-81e6-736273019fb4"
            },

            type: "GET",
            cache:false,
            URL: "http://smp.springworks.info:8081/app1/test/index2.jsp",
            Beforesend:function (Request) {

            },

            success:function (data, ajaxoptions, XHR) {
                mymodules. Module1.debug ("READ SUCCESS");
                Alert (data)
            ,
            error:function (XHR, ajaxoptions, thrownerror) {
                mymodules. Module1.debug ("READ FAILED");
                Alert (Json.stringify (XHR));
                Alert (Json.stringify (ajaxoptions));
                Alert (Json.stringify (Thrownerror));
            }
        );

    

SMP Wireshak Monitoring logs:

 options/app1/test/index2.jsp?_=1476917672878 http/1.1 host:smp.springworks.info:8081 Connection:keep-alive access-control-request-method:get origin:file://user-agent:mozilla/5.0 (Linux; Android 5.0.2; REDMI Note 3 build/lrx22g;
WV) applewebkit/537.36 (khtml, like Gecko) version/4.0 chrome/45.0.2454.95 Mobile safari/537.36 Access-control-request-headers:accept, X-smp-appcid Accept: */* accept-encoding:gzip, deflate ACCEPT-LANGUAGE:ZH-CN,
en-us;q=0.8 X-requested-with:com.mycompany.logon http/1.1 403 Forbidden content-type:text/html;charset=utf-8 Content-language:en content-length:1009 date:wed, Oct 22:54:32 GMT server:sap 
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.