Jump to content

Reading Var from one js file to another


dfowler

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.