为什么我会收到此错误:
未捕获的SyntaxError:意外的令牌
第25行的错误。
$('form.ajax').on('submit', function() {
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
id = that.attr('id'),
data = {};
that.find('[name]').each(function(index, value) {
var that = $(this),
name = that.attr('name'),
value = that.val();
data[name] = value;
});
$.ajax({
url: url,
type: type,
id: id,
data: data,
error: function(response){
$(document).ready(function() { $("div").append("<div id='error'>Error</div>"); });
},
success: function(response) {
//Error on this line -> // $(".comContainer " + id + ).load(location.href+" .comContainer " + id + ">*","");
}
});
return false;
});
这里有什么不对吗?我看不到它
这是获取代码的html代码:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="js/main.js" type="text/javascript"></script>
答案 0 :(得分:2)
您还有一个+
:
$(".comContainer " + id + )
应该是
$(".comContainer " + id)