I have the following:
SignUp.prototype.submitForm = function() {
let that = this;
$(document).on('click', this.buttonSubmitSelector, function(e) {
e.preventDefault();
let current = $(this).closest('form'),
data = current.serialize();
console.log(JSON.parse(data));
// if(that.isEmailValid(emailVal)) {
// that.removeError(emailInput);
// $.ajax({
// type: "POST",
// url: current.attr('action'),
// data: data,
// success: function(){
// that.displaySuccess(current);
// that.resetForm(current);
// }
// });
// }
// else {
// that.showError(emailInput);
// }
});
}
However, I am getting the following error:
VM26559:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1
at JSON.parse (<anonymous>)
at HTMLInputElement.<anonymous> (signUp.js:60)
at HTMLDocument.dispatch (jquery.js:5206)
at HTMLDocument.elemData.handle (jquery.js:5014)
DATA is "form_build_id=form-wKUSwxF8He0krHpGo4N_vzyT9CuUD2HCWNF0dp3tpvk&form_id=sign_up_alert_form&nid=12&title=Production%20Training%20Scheme&email=as-web%40hotmail.com"
I have never come across this error before. How can it be fixed?