How to make JQuery-AJAX request synchronous
you code should be look like .................. $ . ajaxSetup ({ async : false }); $ajax ({ ajax call ....}); $ . ajaxSetup ({ async : true }); like : $.ajaxSetup({async: false}); jQuery.ajax({ type: 'POST', url: '/cgi-bin/VUShare/variant_checker.cgi', data: { 'anop': value}, success: function(res){ VaildOrNot(res,value); }, error: function() { alert('sorry'); } }); $.ajaxSetup({async: true});