Making a synchronous DWR call
Posted on September 18th, 2008 in DWR, JavaScript | 5 Comments »
It took me about half an hour of Googling to find this, and I couldn’t readily find this in the DWR documentation. Hopefully this may save someone some time:
To make a DWR call synchronous (meaning browser-blocking) you must pass an object as one of the arguments of your DWR call with a property async set to false.
I needed this feature in project where a collection object sends out a call for more data if it didn’t have it:
... _getData: function(offset, limit){ var r; DWRcomponent.getComments(offset, limit,{ async: false, callback: function(s){ r = toJSON('(' + s + ')'); } }); return r; } ...