i have an ajax call i am doing and its working just fine. thing is, i need the dimensions of an image. i cant declare these dimensions in html, cause they are dynamically resized. now if i call a function during my complete state, for fetching these dimensions, webkit browsers put out 0, while FF puts out the correct dimensions.
$.ajax({
url: event.path,
cache: false,
error: function(XMLHttpRequest, textStatus, errorThrown) {
handler(XMLHttpRequest.responseText);
},
success: function(data, textStatus, XMLHttpRequest) {
handler(data);
},
complete: function() {
textBoxWidth();
}
});
and this is the called function
function textBoxWidth() {
$("#project .textBox").css("width", $("#project .imgBox:last img").width());
}
any suggestions for this? i tried
if (jQuery.browser.safari && document.readyState != 'complete')
but the document state isnt changing at all, once the DOM is ready..
thanks.
another example, of how to let jquery wait while loading is jQuery.active.
its a variable that spits out 1, if jquery is still loading and 0 if its finished.