Updated javascript due to javascript on zero length url returns.

This was to fix the following javascript error.

Uncaught TypeError: Cannot read property 'length' of null