Add return false; after your ajax request to prevent the page from refreshing.
Code Snippet
$(document).ready(function() {
$("#submitbtn").click(function() {
var first = $("#name").val();
var last = $("#last").val();
var sin = $("#sin").val();
var pwd = $("pwd").val();
$.ajax({
type: "POST",
data: {first:first,last:last,sin:sin,pwd:pwd},
url: "addemployee.php",
success: function(result) {
$("#resultadd").html(response);
}
});
return false; }); });
11
solved how to keep the page from refreshing? jQuery Ajax PHP