询问getscript
html代码如下:
<!DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Transitional / /
EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>jQuery GetScript</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text / javascript ">
$(document). ready(function () {
$getScript ('script.js', function (jd) {
$.each (test, function (index, value) {
console.log (value);
});
});
});
</script>
</head>
<body>
<div id="dest"> </div>
</body>
</html>
js(1)代码如下:-
<script type='text/javascript'> var test = []; test [0] = ['111 ', '222']; </ script>
js(2)代码如下:-
var test = []; test [0] = ['111 ', '222'];
问题如下: - 运行js(1)代码会出现: - Uncaught SyntaxError: Unexpected token <
运行js没问题(二)
想问下js怎么才能跑(1)不能出错 谢谢!写的不好,请见谅。