I have been looking into Jquery's when
then
and deferred
keywords & functions but I couldn't get how do I apply them for a simple 3rd party asynchronous callback method in the ready()
function of one of my views.
What actually happening is that my view gets loaded
with no data because data was supposed to be populated from the completed execution of that asynchronous method in the ready()
, but view is loaded
before the asynchronous callback method could enter it's callback method. I have put an alert in that callback method and it never pops up as page has departed the scripts after loading completely.
Related to this, I have been looking into jQuery.holdReady() as well. I am kind of wandered as to how do I achieve synchronicity in this design.
This is how it looks like.
$( document ).ready(function() {
var xmlRequest = $('#requestStringHiddenField').val();
var action = "getListOfReservations";
asynchronousCallbackCall(xmlRequest, "callbackMethod", action);
});
function callbackMethod(result) {
//unreachable
alert(result);
}
Any help is appreciated.