0

Hi Guys the problem is simple but I can't resolve it - it happen only in FIREFOX here is code:

$.ajax({
     type: "POST",
     url: validUrl,
     data: serializedForm,
     beforeSend: function(x) {
      if(x && x.overrideMimeType) {
       x.overrideMimeType(jsonMimeType);
      }
     },
     dataType: "json",
     success: function(resp){

        console.log(resp);
        var arr = jQuery.parseJSON(resp);
     }
    });

console.log give such answer:

["emailAddress.used", "register.confirmRulesError"]

I have error in:

var arr = jQuery.parseJSON(resp);

Full error:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

This happens only in FireFox and I can't find solution.

Response header is: Content-Type application/json;charset=UTF-8

Any ideas how to solve this ?

1 Answer 1

1

try without parse json you data.because,

response data look like this,

 ["emailAddress.used", "register.confirmRulesError"]

if you tring to parse,need key,value pair in json,that is reason it thorw exception.

{["emailAddress.used", "register.confirmRulesError"]}//not allowed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.