我根本不知道为什么会收到此错误(我读了每个具有类似名称的主题,但这些问题的答案均不适用):
$(document).ready(function() {
postAndFade($node, post_key) {
var id = $node.parents.('.id').find('.id-value').text();
var post_val = $node.text();
$node.fadeOut('slow');
$.ajax({
type: "POST",
url: "process.php",
data: "id="+id+"&"+post_key+"="+post_val,
success: function(data) {
$node.html(data);
$node.fadeIn('slow');
}
});
return false;
}
$('.featured-value').click(function() { return postAndFade($this, 'featured'); });
$('.visible-value').click(function() { return postAndFade($this, 'visible'); });
});
最佳答案
postAndFade($node, post_key) {
您缺少
function
关键字。var id = $node.parents.('.id').find('.id-value').text();
在
.
之后,您还有一个额外的parents
。
关于javascript - jQuery : missing ; before statement,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7663813/