$.ajax({ type: "POST", url: "ajax/check_policy_name_is_exists.php", async: false, // Add async:false for stop next script execution data: data, success: function(data) { } });