2011-07-24 91 views
-2
$(document).click(function(){ 
    getComments(); 
}); 

function getComments() 
{ 
    var directory = $(".active img").prop("src"); 
    directory = directory.substring(58); 
    //alert(directory); 
    $("#photoComments").text(directory); 
    $.post('getPhotoComments.php', function(output){ 
     //$("#photoComments").html(output); 
     $("#photoComments").html("jus checkin2").show(); 
    }); 
} 

以上是我的代码。一切工作,直到我开始$ .post的部分。 function()没有任何作用。我只是测试,看看它是否会将我的ID #photoComments设置为提供的文本:“jus checkin 2”,但似乎没有发生。请真的需要帮助。是的,我有“getPhotoComments.php”设置正确,并没有被使用。由于

+0

你的意思是回调中的代码不会运行,或运行,但“只是检查”事不显示? –

+1

任何错误讯息?任何来自Firebug(或类似)?我认为我们需要更多帮助你。 –

+1

你可以告诉你getPhotoComments.php,如果你没有发布任何文件,然后使用得到... –

回答

0

埃夫拉:尝试把它变成

$(function(){ 
    //your code 
}); 
+0

感谢成因,但我看到了一个地方,如果你把你的jQuery javascript代码放在body标签中而不是头部,那么它没有必要把它放在函数openeing和closing支架中。纠正我,如果我错了,但我只是问。 –

+0

尝试做我建议的。 – genesis

相关问题