Here I am facing an issue with jquery holdReady .
$.holdReady(true);
$.getScript("someXJqueryPlugin.js", function() {
$.holdReady(false);
});
In my ready function
$(document).ready(function(){
someFunctionFromMyPlugin();
});
Because of someXJqueryPlugin.js
is some what bigger in size .So i am trying to delay the the ready function untill my plugin loaded.
Still iam getting the error someFunctionFromMyPlugin not a function .
Any hints ??What I am missing ?? please help .
Thanks in advance.
Here I am facing an issue with jquery holdReady .
$.holdReady(true);
$.getScript("someXJqueryPlugin.js", function() {
$.holdReady(false);
});
In my ready function
$(document).ready(function(){
someFunctionFromMyPlugin();
});
Because of someXJqueryPlugin.js
is some what bigger in size .So i am trying to delay the the ready function untill my plugin loaded.
Still iam getting the error someFunctionFromMyPlugin not a function .
Any hints ??What I am missing ?? please help .
Thanks in advance.
Share Improve this question edited Feb 21, 2013 at 19:15 Suresh Atta asked Feb 21, 2013 at 19:08 Suresh AttaSuresh Atta 122k38 gold badges206 silver badges315 bronze badges 3- I cross checked with my path of js .its correct . – Suresh Atta Commented Feb 21, 2013 at 19:10
- 2 This depends heavily on your code. Most likely the ready event has already fired. You need to call holdready asap, the best would be directly in the head. – Christoph Commented Feb 21, 2013 at 19:16
- @Christoph ok.Let me give a try . – Suresh Atta Commented Feb 21, 2013 at 19:19
1 Answer
Reset to default 5I'd suggest placing the document ready inside of the done callback.
$.getScript(url,function(){
$(document).ready(function(){
// do stuff
});
});
or using deferreds:
$.when( $.getScript(url), $.ready ).done(function(){
// do stuff
});
Note $.ready
is not documented and is subject to change, you can replace it with the following for a more stable version:
$.when( $.getScript(url), $.Deferred(function(def){
$(def.resolve);
})).done(function(){
// do stuff
});