Home re-call variable attached function from another function
Reply: 0

re-call variable attached function from another function

user1108
1#
user1108 Published in May 21, 2018, 3:11 am

Sorry if my question title is somewhat confusing, but I have no idea on how to ask this question in a single sentence...

I have this code:

clientInformation = (function() {
//var priser = null;
$.ajax({
        'async': false,
        'global': false,
        'cache': false,
        'url': stepp+'json/dataFile.json?ver='+Math.random(),
        'dataType': "json",
    'success': function(data) {
            clientInformation = data;
        //console.log('client collected',data);
    }
    });
    return clientInformation;
})();

Which runs on page load. IF there's a change in the dataFile.json I would like to reload the above script.

I would expect that If I type:

clientInformation()

the function would fire again, but... All I get is: "clientInformation is not a function".

I have tried:

clientInformation
clientInformation.call()

How can I re-call the above function without having to rewrite or create a separate function to do the same job over again ?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.553466 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO