I have been on this for a while now. For some reason my Password field does not arrive to my editaccount.php via ajax. Please confirm the Jquery is Correctly setup to add the pass to the variables to send if pass is NOT disabled. I would like to confirm ALL other fields DO SEND.
No one seems to know the fix to this. If check this if statement using alert() in console then yes it should work. But the pass never gets placed into the object myData. Why? How can i fix this? I know the password select is correct. if i remove the if statement then the pass is delievered.
JQuery:
$(document).on('submit', '#editaccount', function(event) {
event.preventDefault();
myData = {
contactname: $('input[name=contactname]').val(),
business: $('input[name=business]').val(),
email: $('input[name=email]').val(),
code: $('input[name=code]').val(),
phone: $('input[name=phone]').val(),
priceband: $('input[name=priceband]').val(),
address: $('input[name=address]').val(),
active: $('input[name=active]').val(),
mon: $('input[name=mon]').val(),
tue: $('input[name=tue]').val(),
wed: $('input[name=wed]').val(),
thu: $('input[name=thu]').val(),
fri: $('input[name=fri]').val(),
sat: $('input[name=sat]').val(),
sund: $('input[name=sund]').val(),
adminname: $('input[name=adminname]').val(),
accountid: $('input[name=accountid]').val(),
isadmin: $('input[name=isadmin]').val(),
};
var isDisabled = $('input[name=pass]').is(':disabled');
if (isDisabled == false) {
myData.pass = $('input[name=pass]').val();
}
$.ajax({
url: 'php/editaccount.php',
type: "POST",
data: myData,
success: function(data) {
if ($('input[name=isadmin]').val() == 1) {
$('input[name=accountsearch]').val($('input[name=email]').val());
$('input[name=accountsearch]').submit();
} else {
$('input[name=accountsearch]').val($('input[name=business]').val());
$('input[name=accountsearch]').submit();
}
alert(data);
}
});
});