i'm writing a GreaseMonkey script (using JQuery), and i need some variables that are set by a script in the original page, like this:
<script type="text/javascript">
var rData = {"20982211":[1,0,1],"20981187":[8,0,4]};
</script>
I fetch this element from another page and try to eval it, put strangely this doesn't work:
$.get(link_url, null, function(data) {
alert("1:" + rData);
eval($(data).find("script").text());
alert("2:" + rData);
}
The strange thing is on the firebug console it works (i just tried the eval directly on the targetpage without the .get), when i run the script though it doesn't. It gives me "null" in both alerts.
Any ideas?