以下脚本失败,我不明白为什么。谁能看到任何明显的东西?我只是使用并提醒以确保userID和postID是正确的,所以我知道对值的调用是正确的,我在同一目录中有处理页面,只是为了让它现在正常工作。
$(document).ready(function() {
$('#saveme').click(function() {
$.ajax({
type: "POST",
url: "save_recipe.php",
contentType: "application/json; charset=utf-8",
data: { 'postID': $('#post_id').val(), 'userID': $('#user_id').val() },
dataType: "json",
success: function (msg) {
alert("This recipe has been saved in your profile area!");
},
error: function (request, status, error) {
alert(request.responseText);
},
//alert('PostID: '+ $('#post_id').val() +' UserID: '+$('#user_id').val());
});
});