Javascript 铬:未捕获合成错误 function(){ setTimeout(函数(){ $('#refresh').html(''); },900); } );
我不明白它为什么每次都给我这个错误: 未捕获的语法错误:意外标记非法 在这一排Javascript 铬:未捕获合成错误 function(){ setTimeout(函数(){ $('#refresh').html(''); },900); } );,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,我不明白它为什么每次都给我这个错误: 未捕获的语法错误:意外标记非法 在这一排 function(){ setTimeout(function (){ $('#refresh').html('<a href="http://www.accuweather.com/en/bg/plovdiv/49959/weather-forecast/49959" class="aw-widget-legal"></a><div id="awc
function(){
setTimeout(function (){
$('#refresh').html('<a href="http://www.accuweather.com/en/bg/plovdiv/49959/weather-forecast/49959" class="aw-widget-legal"></a><div id="awcc1400681634150" class="aw-widget-current" data-locationkey="49959" data-unit="c" data-language="bg-bg" data-useip="false" data-uid="awcc1400681634150"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script></div>');
},900);
}
);
$('#refresh').html('';
这是因为字符串中有
。你将不得不逃避这个”
,或者换一种说法”
你有额外的)代码>在末尾。您可以删除它,或者如果您想立即调用它,可以在函数之前添加(
和之前添加();
。这是正确的,只需要转义关闭脚本
标记
$('#refresh').html('<a href="http://www.accuweather.com/en/bg/plovdiv/49959/weather-forecast/49959" class="aw-widget-legal"></a><div id="awcc1400681634150" class="aw-widget-current" data-locationkey="49959" data-unit="c" data-language="bg-bg" data-useip="false" data-uid="awcc1400681634150"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script></div>');