Creating a Synchronous call using Prototype
Tried to make a Synchronous Ajax call using the Script.aculo.us Library. Damn how do you do it ?
But got a chance to peek into prototype.js. Wow. Javascript can be beautiful.
new Ajax.Request('/foo/bar', {asynchronous:true});
Looking at the code, setting the 'asynchronous' flag to 'false' should do the trick. Unfortunately, this does not seem to work.
new Ajax.Request('/foo/bar', {asynchronous:false});
WierdBut got a chance to peek into prototype.js. Wow. Javascript can be beautiful.
2 Comments:
I was saved with the same problem, digging deeper into prototype i came up with something that works .. although i dont know if this is the right way of doing it
var myAjax = new Ajax.Request( url, { method: 'get',parameters: pars, asynchronous:false });
alert(myAjax.transport.responseText);
Yup, had the same problem myself, I added method:"get" before my onSuccess or onFailure and my ajax calls worked. Oddly enough I didn't have this problem running on my local server. Tootired to figure out why.
Post a Comment
<< Home