cross domain AJAX
November 25, 2006 by nxt
Using AJAX (which implies the use of the XMLHttpRequest) has one big
limitation, you can only make requests to the server from where the
page was downloaded.
As an alternative you can use javascript to dynamically include other javascript files which should be generated serverside.
An example on how to call the server:
function callServer() {
var head = document.getElementsByTagName("head").item(0);
var myTag = document.createElement("script");
myTag.setAttribute("type", "text/javascript");
myTag.setAttribute("src",
"http://example.com/application/getjs/?var1=value1");
head.appendChild(myTag);
}
The idea is that you generate the javascript that you need by dynamically add another script tag on the page.
for an excellent example of this approach you can read this javaworld article
ajax
July 05, 2005 by nxt
I recently discovered Direct Web Remoting.
DWR is a framework wich makes it easy to call serverside code from the
client side and allows you to do all kind of cool things. Even though
it is still impossible to push information from the server to the
client this allows you to build a more rich interface.
for example, if you wanted to update a record in the database through a
form, this technology allows you to verify if the new data can be
inserted or if the record has been updated by another user without the
need to leave the page.
Another example is Google Suggest which provides a list with possible search terms and the amount of results while you type.