JQuery dialog only shows up after JS processing

Tengo el siguiente código:

[DOCUMENT READY]

$("#hincl_working").dialog({autoOpen: false, modal: true});

[SOME JS FUNCTION]

$("#hincl_working").dialog("open");

PROCESSING (takes a few seconds sometimes)

I would like the dialog to open BEFORE the processing starts (and then close right after the processing), but the dialog only shows up AFTER the processing, which is not what I want. Any thoughts?

preguntado el 31 de julio de 12 a las 11:07

1 Respuestas

use javascript's setTimeout to delay your processing with 100 milliseconds or so

https://developer.mozilla.org/en/DOM/window.setTimeout

call your PROCESSING function like this, maybe also change the casing.

window.setTimeout(function(){PROCESSING(tile, id)}, 100); 

Respondido 31 Jul 12, 14:07

I tried adding the following: var timeID = window.setTimeout(PROCESSING ( tile, id ), 1000 ); but it doesn't work (the dialog no longer shows up at all) - iuman

You an probably even lower the timeout to 100 or 50 or so, just to make sure it doesn't seem unresponsive. - Willem D'Haeseleer

I thought as much. It works fine with the timeout set to 50. Thanx - iuman

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.