-
Jul 21st, 2020, 12:31 AM
#1
[RESOLVED] JSON.parse error on some computers
The exact error is "SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" and I couldn't really pinpoint where the problem is. It is working fine in Windows 10 64 bit and Windows 7 64 bit, isn't it supposed to be not dependent on the OS?
I am just uploading data using "$.ajax({". When checking in the network request, there is no Response being received.
This is giving me a headache, I hope someone here could shed light on this. TIA!
-
Jul 21st, 2020, 03:10 AM
#2
Re: JSON.parse error on some computers
It appears that it 'may' have been affecting 32 bit versions of OS and I don't know why. Removing the following solves the issue:
Code:
header('Access-Control-Allow-Origin: ' . $origin);
It is rather baffling why this is not applicable to all browser versions. Marking this as resolved for now but in case someone points to the reason why this is happening then please do so.
-
Jul 23rd, 2020, 09:49 AM
#3
Re: [RESOLVED] JSON.parse error on some computers
This is a good edge case to be aware of, I'm glad that you were able to resolve it.
What confuses me is that a simple CORS definition shouldn't have any effect on what you're experiencing. I wonder if there is something behind the scenes that is causing the data to be truncated when Access-Control-Allow-Origin is set. Because I think that is what is happening, on 64bit browsers you're getting the full JSON whereas on 32bit browsers you're getting a truncated version of the JSON which is causing the parsing error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|