Hi I have a project here at work where we need a specific value from another domain I do not have access to change (So I can’t do nested iframes, or CORS). We need to keep Session/Cookie state the same to get the required data from the page as the token changes based on the user on the page. So a server side solution wouldn’t work.
What is the best way to go about this, the following is what the page source is in it’s entirety.
I need to retrieve the FF321332 value
{"<!--":"","token":"FF321332","expire":1317448445,"":"--><body onload=document.body.innerHTML=clear>"}
Some things I’ve tried so far are Dynamic Script Tags “It throws a JS error Unexpected token : error, Jquery (.getScript ) this throws the same error, any other form of .get or xhr will throw a Cross Domain Error.
I feel like I was on the right track with the .getScript or Dynamic Script Tags as it almost wants to read it in. But if I can get around the Unexpected token error and just read it in as text (if this is possible) I can just parse out the variable as normal text.
Any assistance in this would be greatly appreciated.
JSONP allows you to do what you are trying to do. Check out the jQuery doc on how to make your .get use JSONP to side step the browser cross-domain enforcement.
Essentially, when you do $.getJSON, if the url has a piece that says “callback=” + whatever, then it will treat it as jsonp instead of the standard getjson.
Good luck.