丢失的 ; before 语句: $(this).closest('tr').find('.tableRow'){\n
$('.removeItem').live('click',function(){
var postData = {};
$(this).closest('tr').find('.tableRow'){
var keyPrefix = 'data[' + index + ']';
postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text();
postData['data['+ index +'][order_id]'] = $('#order_id').text();
};
我不确定我想做的事情是否显而易见,但有人能发现我哪里出错了吗?
编辑:
完全是我的错,在我原来的帖子中有点误导,这是我的完整代码:
$('.removeItem').live('click',function(){
var postData = {};
$(this).closest('tr').find('.tableRow'){
var keyPrefix = 'data[' + index + ']';
postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text();
postData['data['+ index +'][order_id]'] = $('#order_id').text();
)};
$.ajax
({
type: "POST",
url: "deleterow.php",
dataType: "json",
data: postData,
cache: false,
success: function()
{
alert("Item Deleted");
}
});
$(this).closest('tr').remove();
calcTotal();
});
$('.removeItem').live('click',function(){
var postData = {};
$(this).closest('tr').find('.tableRow'){
var keyPrefix = 'data[' + index + ']';
postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text();
postData['data['+ index +'][order_id]'] = $('#order_id').text();
};
I'm not sure if its obvious what i'm trying to do but can anyone spot where i'm going wrong?
EDIT:
Completely my fault, was slightly misleading in my original post, this is my complete code:
$('.removeItem').live('click',function(){
var postData = {};
$(this).closest('tr').find('.tableRow'){
var keyPrefix = 'data[' + index + ']';
postData[keyPrefix + '[index]'] = $(this).closest('tr').find('.row_id').text();
postData['data['+ index +'][order_id]'] = $('#order_id').text();
)};
$.ajax
({
type: "POST",
url: "deleterow.php",
dataType: "json",
data: postData,
cache: false,
success: function()
{
alert("Item Deleted");
}
});
$(this).closest('tr').remove();
calcTotal();
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这里的这一行:
缺少一些东西。什么?不清楚,但也许应该是
This line here:
is missing something. What? Not clear, but maybe it should be
您忘记了
.live
调用中的结束)
。忽略回调的内容,您的代码是
注意您正在调用一个带有两个参数的函数,但没有关闭括号。
You forgot the closing
)
in the.live
call.Ignoring the contents of the callback, your code is
Notice that you're calling a function with two parameters, but not closing the parentheses.
从“index”变量来看,我认为代码应该是:
Judging by the "index" variable, I think that the code should be:
您没有关闭“实时”功能块。您需要将
});
添加到最后一行的末尾。You don't close the "live" function block. you need to add
});
to the end of last line.