我不知道为什么会出现这个错误,我只是想把在索引页中工作的表单移到post页。我只是简单地移动了表单,但是没有工作;uncaughttypeerror:由于某种原因无法读取undefined(匿名函数)的属性'split'。在
{% crispy comment_form comment_form.helper %}
$(document).ready(function() {
$(document).on('submit', 'form', function(e){
e.preventDefault();
if($(this).parents("tr").length != 0) {
parent_id = $(this).parents("tr").attr("id").split("_")[1];
data_str = $(this).serialize() + "&parent_id=" + parent_id;
} else {
data_str = $(this).serialize();
}
$.ajax({
type:'POST',
url:'/comment/create/', // make sure , you are calling currect url
data:data_str,
success:function(json){
alert(json.message);
if(js