jquery - JavaScript: function not working without alert() -


possible solution

hello, fellow programmers!

i writing in order request issue experienced. issue follows:

1) have ajax request, implemented jquery.

2) after returning successful response, script should reload page respective changes , if there validation errors, insert them after hidden field, used store non-critical miscellaneous data. if there validation errors, changes not saved , page reloaded validation error messages. validation taken care of servlet.

3) noticed works fine, when kind of alert() presented before actual appending of error messages, not want have such alert.

here javascript code:

$('#randomformelement').submit(function() {         $(this).ajaxsubmit({             success: function (data, status) {                 randomfunctiontoreloadthepage(arg1, arg2, arg3);                 var errors = $(data).find('.classnameoftheerrors').xml();                 //alert(something);                 $(errors).insertafter('#idofthehiddenfield');             },             error: function (jqxhr, textstatus, thrownerror) {             //error handling if ajax response fails.             }          }); }); 

so, main question is: what's deal alert() making work?

==========================

on chrome, doesn't work either way.

on ff, work when alert() present.

thanks in advance!

the alert() function blocks code execution , delays processing of javascript code on bottom of it. give time ajax request complete.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -