Hi Everyone, i have a problem with my code, don’t understand where. when trying to send the ajax request to create an account i get 406 error. can somebody help with this? Thanks in advance.
var customerdata = {
'customer[email]': "dev@astraverdes.com",
'customer[password]': "12345",
'customer[first_name]': "Dan",
'customer[last_name]': "Test",
'form_type': 'create_customer',
'utf8' : '✓'
};
$.ajax({
url: "/account",
type: "POST",
data: customerdata,
dataType: 'json',
beforeSend: function(x) {
$('.js-customer-create').remove( $('.registration-form-errors') );
},
success: function(result) {
alert("SUCCESS:"+result);
$('.js-customer-create').prepend(`Thank You, account has been successfully created.
`);
// window.location.href = "/account";
}, error: function(jqXHR, textStatus, errorThrown) {
console.log(jqXHR);
alert("FAIL:"+textStatus+"::jqXHR:"+JSON.stringify(jqXHR)+"::Error Thrown:"+errorThrown);
console.log("jqXHR Error:"+JSON.stringify(jqXHR));
}
});