The code is working, however it is being sent as GET in the URL.
I have looked at other questions here but none seem relevant.
$("#securityInfoUpdate").click(function() {
var newUserName = $('#securityInfoUserName').find(":input").val();
var newPassword = $('#securityInfoPassword').find(":input").val();
$.post( "ajaxProcessing.php", { username: newUserName, password:newPassword } )
.done(function( data ) {
var success = jQuery.parseJSON(data);
if (success == 1){
$("#securityInfoMessage").html('YES!! DATABASE CHANGED');
}else if(success == 2){
$("#securityInfoMessage").html('PROBLEM BUDDY!');
}
});
});
It is also causing a page refresh. What could be the reason for this?
Let me know if other information is required or relevant.
HTML
<form id= "securityInfoValuePairs">
Change username and password:<br/>
<div id="securityInfoMessage">
</div>
<div id="securityInfoUserName">
</div>
<div id="securityInfoPassword">
<label for="passwordLate">NEW or OLD Password:</label>
<input type="text" name="passwordLate" placeholder="PLEASE ENTER A PASSWORD">
</div>
<button id="securityInfoUpdate">UPDATE</button>
</form>
BTW info and input fields in form are supplied by js via loalStorage