Update: I found the reason I am using $.getScript()接口时,jQuery内部把请求的url进行了进一步的封装,本来是http://hq.sinajs.cn/list=sh600000,能正常获取到数据,但是经过jQuery封装之后就变成了http://hq.sinajs.cn/list=sh600000?_=1494754956348(在NetWork里面查看),多了一个查询参数_,值是一个时间戳,而带参数的url,新浪那边是做了一些处理的,返回的内容也就变成了截图1中的内容,进而导致语法报错。所以,新浪的这个接口不能用$.getScript() to get it, or write a function to load js myself!
The error part means that there is a syntax error: identifier ?? 看了一下,你的变量名里面有?I looked at it and found that there is ? in your variable name, and a syntax error is reported. js variables must start with a letter, underscore, or dollar sign, and subsequent characters can be letters, numbers, underscores, or dollar signs.
Update: I found the reason
I am using
$.getScript()
接口时,jQuery内部把请求的url进行了进一步的封装,本来是http://hq.sinajs.cn/list=sh600000
,能正常获取到数据,但是经过jQuery封装之后就变成了http://hq.sinajs.cn/list=sh600000?_=1494754956348
(在NetWork里面查看),多了一个查询参数_
,值是一个时间戳,而带参数的url,新浪那边是做了一些处理的,返回的内容也就变成了截图1中的内容,进而导致语法报错。所以,新浪的这个接口不能用$.getScript()
to get it, or write a function to load js myself!The error part means that there is a syntax error: identifier
?
?
看了一下,你的变量名里面有
?
I looked at it and found that there is?
in your variable name, and a syntax error is reported. js variables must start with a letter, underscore, or dollar sign, and subsequent characters can be letters, numbers, underscores, or dollar signs.Is there an * in the URL?