I have a weird problem with one of my ajax submitted forms … I have a file-upload in the form and somehow a valid JSON Object from the server is now a String …
if (typeof jsonObject == 'string')
console.log('yes, it's a string'); //yes, it's a string
console.log(jsonObject); // { "status":"success", "data":"Updated profile successfully"}
So, without the file-upload and the enctype:multipart in the form console.log(jsonObject) is returning >Object with a “success” and “data” attribute. With the file-upload in the form somehow the jsonObject is a string like you can see above.
Any ideas what could cause that? Or how can I convert the string back to a valid JSON object?
Thank you in advance.
1 Answer