3

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?

Mat
  • 7,613
  • 4
  • 40
  • 56
Roberto Zamora
  • 250
  • 2
  • 11
  • 2
    See this post for an answer: http://stackoverflow.com/questions/7747264/jsonp-calls-not-working-with-apple-mobile-web-app-capable-yes – Aleksey Sep 18 '13 at 20:43

1 Answers1

0

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

Alexey B.
  • 11,965
  • 2
  • 49
  • 73