Navee
Navee

Reputation: 17

how to load a same funcion twice in javascript file

I am having init function and i want to load this init function again by calling the same method. I just want to refresh once the same loaded page.

Example code is

Ext.onReady(Kbase.init, Kbase);

this will call

Kbase.init = function(){
    /* ... */
}

I just want to load this init function again in same js file. Or else I just want to refresh once the same js page.

Upvotes: 0

Views: 72

Answers (2)

prog1011
prog1011

Reputation: 3495

Use Below Code

var cnt=1;
var repeatFunction = setInterval(function(){
if(cnt<3){
    //callYourFunction();
    alert('function called :'+cnt);
    Kbase.init;        
}
else{
    repeatFunction =null;
}
    cnt=cnt+1;
},500);

Use setInterval() will meet your task.

Upvotes: 1

Justinas
Justinas

Reputation: 43481

Just try to call init function once more.

Ext.onRead(Kbase.init, Kbase);
/* ... */
$("button").click(function(){
    Kbase.init;
});

Or check if there is any "updated" function for that object.

Upvotes: 1

Related Questions