2013-03-13 64 views
0

为什么我得到这个错误:未捕获的SyntaxError:意外的标记的jQuery

未捕获的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> 

回答

2

你有一个额外+

$(".comContainer " + id + ) 

应该

$(".comContainer " + id) 
+0

谢谢非常 :) – Thayer 2013-03-13 23:03:28

相关问题