您好我在Chrome控制台中出现此错误:无法加载资源:服务器响应状态为404(未找到)http://localhost/wordpress/add_likes.php
js source
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
js代码是
function addLikes(id,action) {
$('.demo-table #tutorial-'+id+' li').each(function(index) {
$(this).addClass('selected');
$('#tutorial-'+id+' #rating').val((index+1));
if(index == $('.demo-table #tutorial-'+id+' li').index(obj)) {
return false;
}
});
$.ajax({
url: 'add_likes.php',
data:'id='+id+'&action='+action,
type: "POST",
beforeSend: function(){
$('#tutorial-'+id+' .btn-likes').html("<img src='http://localhost/wordpress/wp-content/uploads/2016/12/loaderIcon.gif' />");
},
success: function(data){
var likes = parseInt($('#likes-'+id).val());
switch(action) {
case "like":
$('#tutorial-'+id+' .btn-likes').html('<input type="button" title="Unlike" class="unlike" onClick="addLikes('+id+',\'unlike\')" />');
likes = likes+1;
break;
case "unlike":
$('#tutorial-'+id+' .btn-likes').html('<input type="button" title="Like" class="like" onClick="addLikes('+id+',\'like\')" />')
likes = likes-1;
break;
}
$('#likes-'+id).val(likes);
if(likes>0) {
$('#tutorial-'+id+' .label-likes').html(likes+" Like(s)");
} else {
$('#tutorial-'+id+' .label-likes').html('');
}
}
});
}
并且,是的,我正在使用wordpress。
我希望有人可以帮助我:(