简体   繁体   中英

JSONP in Safari/iPhone and Opera/Android doesn't work

Im trying to make a JSONP request that works in all desktop browsers but it doesn't in iPhone and Android.

Im doing a cross domain call to a webservice which returns a JSONP like:

myFunction({name : "Jonh", last : "Doe"})

        $.ajax({
                type: "GET",
                crossDomain: true,
                url: "http://192.168.1.41:8081/Service1/",
                dataType: "jsonp",
                processData : true,
                headers: {
                    "Content-Type": "application/json"
                },
                jsonp : "myFunction",
                jsonpCallback: "myFunction"
                });

    function myFunction(data)
    {
        alert("Hello world!");
    }

It WORKS on DESKTOP but not in mobile!

Any idea?

My problem was that I send JSONP request from http server(my dev machine) to https server.

to be fully clear its looks like

request from http://localhost.com to https://api.xxx.com

It works at all browsers except mobile safari.

http -> http = work
https -> https = work
http -> https = not work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM