I have a form for a model that has some required fields. I am trying to check those fields unobtrusively. I keep getting a invalid character in a line json.parse of jquery.
var formm;
if (id == null) {
if (!$("#formCDmartAdd").valid()) {
return false;
}
formm = $("#formCDmartAdd").serialize();
}
When it checks the valid it errs and posts the form, which I don't want. What is causing this? I am using jquery 2.2.3 and the older files, 2.1.4 are still in the scripts folder. Another puzzling thing is that it does not fail in development but only on the production server.
I removed 2.2.3 and the minified version of 2.1.4. In the standard file for 2.1.4 I changed at line 7521 to this:
jQuery.parseJSON = function( data ) {
if (data != undefined) {
return JSON.parse(data + "");
}
};
I added the check for undefined before trying to parse. This seems to have worked.