Results 1 to 3 of 3

Thread: [RESOLVED] JSON.parse error on some computers

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Resolved [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!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    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.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,808

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width