From a page containing (or referring to) my JavaScript I do an AJAX XHR request to an external Web site.
The external Web site return on our GET request a JavaScript file like this:
var __xxx = {
// ....
};
How do I get the value of the variable __xxx in my JavaScript?
Currently, the only way I invented is to remove var __xxx using a regular expression and parse the remaining using a JSON parser. Is there a better way?
The external Web site may be considered as trusted if necessary, but I would prefer not to trust the data from it (using some safe parser like JSON).
<script>tag on you page and insert the JS code into it<script>and re-create it for every event?