I’m having a problem with an ajax script that checks postcodes against a region table in the database to find which area the postcode relates to, then updates the region select list with this information.
There’s nothing wrong with the ajax scripting at all, because it works from another page just fine. A particular page (in an admin area I can’t give access to) is having problems and my debugger says “Uncaught TypeError: Cannot read property ‘length’ of null” when the call to the remote script is triggered.
I’m baffled by it, because I’m clueless as to what it’s suggesting is null. I understand what it’s saying, that it can’t read the length of null, obviously, but I can’t see what it could be that’s null. It may be being given an empty string, but an empty string doesn’t trigger this error on the other pages, and an empty string isn’t null.
I know I’ve not given much to go on, but if you could offer any more debugging advice, it’d be great.
Thanks.
Peter Olson’s suggestion was great, I’ve since explored and discovered lots of powerful debugging tools built into Chrome (I’m sure Firebug, etc, have the same stuff).
It turned out to be that a script used getElementById on an element that didn’t have an Id. Hence why the script worked fine on the other pages (the inputs on the other pages had IDs)
I’ve fixed the problem now.
Thanks a lot.