tags:

views:

48

answers:

3

Hi friends,

When I am calling a REST service through AJAX, its working fine. I am calling it with the URL staring with HTTP e.g.: http://www.myserver.com/customers. Its works really great.

But when I am calling a same URL but with HTTPs e.g.: https://www.myserver.com/customers, I am not getting any response from server.

Its not working for GET or POST both. Its not working in Mac firefox, actually I am developing an application for iPhone using phonegap framework. Its also not working in iPhone simulator's mobile safari. Can anyone here know what problem is this? And how to solve this?

+1  A: 

The requesting domain must match the requested domain down to the protocol, according to the Same Origin Policy

David Hedlund
A: 

It could probably be because of same origin policy. read

http://en.wikipedia.org/wiki/Same_origin_policy

sushil bharwani
Thanks for reply, but same thing works when I am running it in mac safari. Is there any way to bypass the problem, in mobile safari?
Jprogyog
A: 

Same problem: http://stackoverflow.com/questions/2499499/ajax-and-rest-can-i-send-an-ajax-request-to-a-rest-service-to-recieve-response

Solutions:

  1. JSONP (JSON with padding)
  2. CORS (cross-origin resource sharing)
K.Rijpstra