[jQuery/JavaScript] Blocking for asynchronous function calls

Soldato
Joined
12 Apr 2004
Posts
11,788
Location
Somewhere
I'm pretty new to JavaScript, so this is probably quite a simple question: if I call an asynchronous jQuery function, how do I block the currently executing function until a callback completes?

Example:
Code:
$("input.delete-image").click(function()
{
	$.prompt('Foo', { buttons: { OK: true, Canncel: false }, callback: function(value, message)
	{
		// Some callback code.
	}});
	
	// Return true or false depending on result of dialogue box.
});

Basically I want to use the value argument passed into the callback as the return value of the click event handler.
 
Back
Top Bottom