I have access to two different servers. Server #1 has a lot of sensitive information. I programmed it to be able to format that information as JSON objects. All information on server #1 is encrypted (https://)
I programmed a site on server #2 (using JQuery). It basically does this:
var URL = 'https://sensitiveInfo.json'
$.getJ开发者_开发问答SON(URL, function(data) {
...
});
However, server #2 cannot seem to access the JSON object from my encrypted server #1. If I encrypt server #2 (make it https:// instead of http://) will that allow it to handle the encrypted information?
No idea what you are talking about but as long as you don't violate the same origin policy you will be able to send AJAX requests. But if you change the port you violate this policy. For example if you try to send an AJAX request to an HTTPS from a page serverd from HTTP this won't work.
The best way to ensure you are not violating this policy is to use relative urls:
var URL = '/sensitiveInfo.json'
$.getJSON(URL, function(data) {
...
});
JSONP is an alternative to circumvent this browser restriction.
精彩评论