coder and technology lover
Google Closure’s idiocies: Ajax can’t be synchronous :(
While I love Closure tools and the possibility to write a better organized and OOP based JavaScript, I’m facing some weakness and inexplicable choices in the library. The last discover is that is impossible to make synchronous ajax call using the provided classes, since I didn’t find nothing about synch/asynch options by reading API reference, I took a look to the source (xhrio.js), and I noticed this:
1 | this.xhr_.open(method, url, true); // Always async! |
that true should be a parametric value which developers can set to true or false. Why forcing it to true???
I’m really disappointed :(
| Print article | This entry was posted by Davide Zanotti on 31, Thursday f, 2009 at 4:02 am, and is filed under google closure. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 2 months ago
ajax never can be synchronous:
Asynchronous JavaScript and XML
:)
about 2 months ago
LOL :^) XmlHttpRequest can be opened both in synchronous (asynchronous flag set to “false”) than asynchronous mode (asynchronous flag set to “true”)
about 2 months ago
That is correct, but XmlHttpRequest is a method, AJAX is a technology based on that method.
Otherwise, the JSON version of AJAX is AJAJ, however we use also XmlHttpRequest not JsonHttpRequest. So, we should be cautious when we use these words and abbreviations.
about 2 months ago
XmlHttpRequest is not a method, is an object and it has methods like open(). By saying “ajax” I merely mean an xhr call to retrieve data on demand, this data can be plain text, json, xml or something else and can be retrieved synchronously or asynchronously, but from a generic point of view is always ajax (the term is very generic)… I hope I was clear :^)
about 2 months ago
I accept
about 1 month ago
You can create a XmlHttpRequest with goog.net.XmlHttp and pass true in the third argument of the open method.