I have a problem updating the page after ajax posts, I tried as 6 different options, and once I got the correct result, but I couldn’t stop the page refreshing and after searching the network and around this site now none of them work, and it’s all still refreshing ...
current code:
$('#submit_btn').click(function() {
var curPassword = $("input#curPassword").val();
var newPassword = $("input#newPassword").val();
var new2Password = $("input#new2Password").val();
var params = {
curPassword: curPassword,
newPassword: newPassword,
new2Password:new2Password
};
$.ajax({
type: "POST",
url: "testAjax.php",
data: params,
success: function(msg){
alert(msg);
}
});
return false;
});
the form:
<form method="post" action="" name="confirmChange" class="confirmChange">
<label for="curPassword">Current Password:</label>
<input type="password" name="curPassword" id="curPassword" value="" />
<label for="newPassword">New Password:</label>
<input type="password" name="newPassword" id="newPassword" value="" />
<label for="new2Password">Confirm New Password:</label>
<input type="password" name="new2Password" id="new2Password" value="" />
<br />
<input type="button" name="confirmChange" class="confirmChange" id="submit_btn" value="Change" />
Appreciate any help getting this to work = /
Update: I
pulled out another code that was not directly related, as it somehow cluttered the question. Also updated code to undo the latest version. I changed the ajax url to plain textAjax.php with plain echo hello world nothing else where I still don't get anything.
Update 2
Tried changing javascript code to:
$('#submit_btn').click(function() {
alert('Button Clicked');
});
... , , click ?