I have an API client which makes a JSONP request using JQuery. Everything works fine when this API client\'s not using SSL however fails when the SSL is used.
For e
Changing the protocol is the same effect as changing any other part of the URL -- it will trigger a violation of the same-origin policy and force you into cross-domain mode. If you already have cross-domain access working, it will continue to work with https as well as it did with http.
you can use getJSON for example
$.getJSON('ajax/test.json', function(data) {
$('.result').html('<p>' + data.foo + '</p>'
+ '<p>' + data.baz[1] + '</p>');
});
check complete getJSON documentation http://api.jquery.com/jQuery.getJSON/
will i was wrong ... using Juqery.ajax will cause cross-browser issue but not with Jquery.getJSON
http://docs.jquery.com/Release:jQuery_1.2/Ajax#Cross-Domain_getJSON_.28using_JSONP.29
here is an example of cross-domain get JSON
firefox has a problem with HTTPS, as i know it will be fixed if you send your request like this
$.getJSON('ajax/test.json',{}, function(data) {
$('.result').html('<p>' + data.foo + '</p>'
+ '<p>' + data.baz[1] + '</p>');
});
soruce AJAX https POST requests using jquery fail in Firefox
i hope this helps
There shouldn't be any different in JSONP request for http and https.
Try us .getJSON instead:
$.getJSON(url, function(data) {
$.each(data.services, function(index, service) {
processService(service);
});
});
Using jQuery.ajax() will cause cross-browser issue but not the case with jQuery.getJSON() Look at jQuery site for more info: http://api.jquery.com/jQuery.getJSON/
There's similar post with this issue: JSONP To Acquire JSON From HTTPS Protocol with JQuery
Found a solution. Problem was that JQuery and other resources were imported from non-secure sites. Solution was to reference from https.