Chrome:未捕获的SyntaxError

时间:2014-05-22 10:03:29

标签: 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="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);
    }
    );

我不明白为什么它每次都给我这个错误: 未捕获的SyntaxError:意外的标记ILLEGAL 在这一行

$('#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>');

1 个答案:

答案 0 :(得分:1)

这是因为你的字符串中有</script>。您必须转义"<\/script>"或以不同的方式"</ + script>"

相关问题