I have sending my data in ajax using submit button without any page refresh. But the page refreshed.
Please check my code and let me know the problem.
use event.preventdefault()
$("#idForm").submit(function(e) { e.preventDefault();//use it here to stop default behaviour alert("hi"); var url = "ajax.php"; $.ajax({ type: "POST", url: url, data: $("#idForm").serialize(), success: function(data) { alert(data); } }); return false; });