I’m following this guide trying to set up JSON based communication. However, in order to take control, I’d like to specify the header contents. According to the information at the bottom, only Content-Type and Content-Encoding are specifiable. Is that correct understood?
If I’ve misunderstood, how can I specify the header in the call below?
var requestNumber = JSONRequest.get(
"https://json.penzance.org/request",
function(requestNumber, value, exception){
if(value) {
processResponse(value);
} else {
processError(exception);
}
}
);
Just a shot in the dark here. If you’re successful creating XMLHttpRequest calls, why don’t you use such for receiving JSON formatted data as well? Just because it’s called XML, it doesn’t have to be XML formatted data that is being sent.
Can you, for instance, make a call as you’ve used to with:
Of course, the exact someValue is defined by the contents of the JSON formatted data object. Also, and this is an important note, use the method above (the parser, if you will), only if you know that your data comes from a secure, reliable location. Otherwise, you may write your own, custom parser or download an existing one.