dfowler Posted July 9, 2008 Share Posted July 9, 2008 Hey guys, I'm having a problem and I'm not sure why. I have one js file that is hosted on another server. This file is modified by another source, and basically they are setting a variable as true or false. The contents are as follows: var II_gAgentsAvail = false; Then I have a second js file hosted locally. I need to read that variable and depending on whether it is false or not execute a script. So first, I included the other js file: <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="----location of first .js file----"></SCRIPT> Then I've tried: if(II_gAgentsAvail == false) { document.write('False'); } Just to test, but I'm not getting anything. Does anybody know what I am doing wrong? Link to comment https://forums.phpfreaks.com/topic/113975-reading-var-from-one-js-file-to-another/ Share on other sites More sharing options...
ag3nt42 Posted July 10, 2008 Share Posted July 10, 2008 try alerting the var to see if it has a value.. include the file then say alert(II_gAgentsAvail); I betting there is not a value or the value is not false Link to comment https://forums.phpfreaks.com/topic/113975-reading-var-from-one-js-file-to-another/#findComment-586533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.