I have tried the following way to excute the javascript syncronusly yet i am receiving error..
What I done is firstly i included jquery and jquery ui files dynamically using javascript and after that jquery depends files are present. but at the time of loading the page itexecute the jquery and jquery ui files at last and later part first.
Code Used in single js:
(function(){
var script= document.createElement("script");
script.src="jquery.js";
script.type="text/javascript";
var pelement=document.getElementsByTagName('script')[document.getElementsByTagName('script').length-1];
pelement.insertBefore(script,pelement);
}();
(function(){
var script= document.createElement("script");
script.src="jquery-ui.js";
script.type="text/javascript";
var pelement=document.getElementsByTagName('script')[document.getElementsByTagName('script').length-1];
pelement.insertBefore(script,pelement);
}();
jquery depend files follows
$(document).ready...
Now i recieves error that jquery is undefined.. Even i tried with xmlhttprequest.. but that too failed…
This looks like the perfect situation for usint the jQuery promise interface.
You could declare an asynchronous operation, and specify what happens after it. I use it profusely in very complex interfaces that perform parallel calls, and works pretty well.
Cheers.