当我尝试将某些数据发布到页面以运行数据库函数时,它不会发布数据。当我测试它时,它确实正确地点击了页面,如果我在页面上手动设置变量,数据库功能正常工作。似乎jQuery函数没有正确发布变量。
function attend(operation_id, status, name){
result = confirm("do you wish to RSVP to "+name+" as "+ status +"?");
formName = "attendance"+ operation_id;
var statusNum;
switch (status) {
case "attending":
statusNum=1;
break;
case "not attending":
statusNum=2;
break;
case "maybe attending":
statusNum=3;
break;
}
if(result){
$.post(
//URL
"op_attend.php",
//POST values
{
"status": statusNum,
"op_id": operation_id
},
//on success
function(){
$("#rsvp"+operation_id).css("display","block").text("RSVP Confirmed");
}
);
}
}