#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Red face Fetch value from another javascript


    Parent XUL triggers script2.js, after modal-xul(used for authentication and capturing username) is done with script1.js. So issue is when script2.js triggers, how does it get the value set in app. the alert in script2.js goes into error

    script1.js

    Code:
    var app;
    function method1() {
        var username = document.getElementById('username').value;
        app = new UserText();
        app.setValue(username);
        // more logic
    }
    script2.js

    Code:
    alert(app.getValue());
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Posts
    9
    Rep Power
    0
    You can access variables/functions from other javascript files. How are you including the files? Are you calling method1 before including script2.js?

IMN logo majestic logo threadwatch logo seochat tools logo