[Solved] Uncaught TypeError: Cannot read property 'length' of undefined

Jsonp uses a script tag to make the request (i.e. jQuery adds a <script src="your_url"></script> on the page), so you can’t specify headers for it. If you use dataType: 'json' instead, you can specify the header.