fixed javascript error messages

used:
$(document).ajaxComplete(function() {…..
to keep scripts from running until ajax call is finished