[Solved-4 Solutions] JavaScript error (Uncaught SyntaxError: Unexpected end of input)
Error Description:
In the Chrome JS Console
"Uncaught SyntaxError: Unexpected end of input"
Solution 1:
- When properly indented,our code reads
- We never closed the outer $(function()
Solution 2:
- This is what we have:
- What we don't understand and would need some help, it is with the fact that the response has a status 200, then goes to parseJSON but then goes back to checkStatus and throws that error "unexpected end of input" (debugging step by step using the chrome debugger).
Solution 3:
- This error is mainly caused by empty returned ajax calls , when trying to parse an empty Json .
- To solve this test if the returned data is empty
Solution 4:
- Also, with Google Chrome we can use "pretty print". See the example screenshot below showing jquery.min.js from Stack Overflow nicely indented right from browser
Learn javascript - javascript tutorial - javascript sepo - javascript examples - javascript programs