Execution sequence inside a jquery event handler
- by user576358
I have a big issue with the execution squence inside this jquery handler :
Was wondering if anyone has come accross this before:
I have a simple form:
<form action='foo.cgi' id='myForm' >
<input type=text name='name' />
<input type=submit value='Find it!'/>
</form>
when user clicks on Find it! would like to change the cursor to 'progress' before the data is returned through an ajax call:
$(document).ready(function(){
$("#myForm ").submit(function(){
$("body").css("cursor", "progress") ;
htmlobj=$.ajax({url:server_url,..........);
}
}
However: The cursor [line 2 above ] does not change until data is returned through ajax - Seems like line 3. gets executed before 2.
Any help is greatly appreciated