위와 아래로 질문과 답변을 투표하는 중재 스크립트를 작성했습니다. 시간 전에 스크립트는 작동했지만 다시 한 번이 프로젝트에서 코딩을 시작하기 위해 돌아 왔을 때 더 이상 작동하지 않습니다.게시물로 아약스로 정보를 전송할 때 문제가 발생했습니다.
스크립트가 수행 중입니다. 투표라는 div를 클릭하거나 링크 1을 클릭하면 링크가 위 또는 아래에 있는지 묻습니다. 그것이 끝나면, url을로드합니다 : "mod_up_vote.php"당신이 투표하는 질문에 대한 정보를 게시물로 보냅니다. 괜찮 았어. 그러나 지금은 아닙니다. 내가 $ _POST 변수를 인쇄하고 데이터베이스에 삽입했기 때문에 그 페이지가로드되지 않습니다.
여기에 무슨 생각이 뭡니까? 감사.
$(document).ready(function()
{
$(document).delegate('.vote, .vote1', '.vote2', 'click', function()
{
var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);
if(name=='mod_up')
{
$(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">');
$.ajax({
type: "POST",
url: "mod_up_vote.php",
dataType: "xml",
data: dataString,
cache: false,
success: function(xml)
{
//$("#mod-pregunta").html(html);
//$("#mod-respuesta").html(html);
//parent.html(html);
$(xml).find('pregunta').each(function(){
var id = $(this).attr('id');
var pregunta = $(this).find('preguntadato').text();
var respuesta = $(this).find('respuestadato').text();
var votoup = $(this).find('votoup').text();
var votodown = $(this).find('votodown').text();
var id_pregunta = $(this).find('id_pregunta').text();
var id_respuesta = $(this).find('id_respuesta').text();
$("#mod-pregunta").html(pregunta);
$("#mod-respuesta").html(respuesta);
//$(".vote").attr('id', $(this).find('id_pregunta').text());
$(".vote1").html("<a href=\"modera\" title=\""+ id_pregunta + "-"+ id_respuesta + "-1\" class=\"vote1\" id=\""+ id_pregunta + "-"+ id_respuesta + "-1\" name=\"mod_up\">Aceptar</a>");
$(".vote2").html("<a href=\"modera\" title=\""+ id_pregunta + "-"+ id_respuesta + "-2\" class=\"vote2\" id=\""+ id_pregunta + "-"+ id_respuesta + "-2\" name=\"mod_up\">Rechazar</a>");
//$("span", this).html("(ID = '<b>" + this.id + "</b>')");
});
} });
}
return false;
});
는 당신이 페이지를로드 아니라고 확신합니까? PHP 페이지에 오류가 없음을 확인 했습니까? –
url : "mod_up_vote.php", 데이터베이스에 테스트 값을 삽입하고 아무 것도 저장하지 않습니다. –
하지만 올바르게 삽입 했습니까? "mod_up_vote.php"에 문제가있는 것 같습니다. –