Uncaught TypeError: Cannot read property 'name' of undefined

北战南征 提交于 2019-12-05 02:15:13

On this line:

if(response.location !== 'undefined')

...you're checking if response.location is not the string "undefined". Since undefined is not the string "undefined", the condition is true. Then you try to use response.location.name and as response.location is undefined, you get the error.

You probably meant either:

if(response.location)

or

if(typeof response.location !== 'undefined')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!