[javascript] fix loadRemote implementation for synchronous requests
In case of synhronous requests, loadRemote is supposed to return the
"interpreted" server result (e.g a json object, a DOM object, ...).
$.ajax() always return the XHR object, so we have to use the success
callback to capture the actual server result and return it later.