这是我的Jquery代码:
$(document).on('click', '#saveEdit', function() {
var replyId = $("#editReplyId").val();
$('#cancelEdit').hide();
$('#labelEdit' + replyId).html('<span class="ooc txt-tiny">Updating Record...</span>');
$.post(
'/acz/convo-edit/' + replyId, {
"_token": $("#editForm").find('input[name=_token]').val(),
"editText": "Test",
},
function(data) {
alert(data);
},
'json'
);
//prevent the form from actually submitting in browser
return false;
});
以下是我用来生成表单的更多代码:
$('#labelEdit'+replyId).html('{{ Form::open(array("url" => "/acz/convo-edit/'+replyId+'", "method" => "post", "id" => "editForm")) }}<input type="hidden" name="editReplyId" value="'+replyId+'" id="editReplyId" /><a href="javascript:void(0);" id="saveEdit"><span class="label label-success" aria-label="Save Edit"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></span></a>{{ Form::close() }}');
一切正常,直到达到$ .post似乎......我看不出我做错了什么。我已经测试了“/ acz / convo-edit /”,它可以正常工作,没有错误。如果有人可以帮我解决问题,我已经尝试了一段时间。
这是HTML:
<li id="labelEdit{{ $reply->id }}">
<a href="javascript:void(0);" onclick="showEdit({{ $reply->id }});">
<span class="label label-default" aria-label="Edit">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
</span>
</a>
</li>