任何人都可以帮忙,...我有一个评论页面,其中包含我想用 ajax 调用对话框的报告/垃圾邮件链接,...我该怎么做,..?在此先感谢,...这是我的代码:
<script>
$(function() {
$('#photo_comments_opener_<?php echo $photo_comment['PhotoComment']['id'] ?>').dialog({
autoOpen: false,
width: 500,
modal: true,
title: 'Report Photo Comment',
open: function ()
{
$.ajax(function(){
url: "<?php echo $html->url("/report/photo_comment/" . $photo_comment['PhotoComment']['id']) ?>",
data: data,
type: "post",
sucess:function(msg){
$('#photo_comments_opener_<?php echo $photo_comment['PhotoComment']['id'] ?>').html(msg)
}
});
}
});
});
</script>
这是链接:
<?php echo $html->link(ucfirst(__('report', true)), 'javascript:void(0)', array('id' => "photo_comments_opener_".$photo_comment['PhotoComment']['id'], 'class' => 'report')) ?>
感谢您的回复 Chintana,...但是我无法成功,...我有一个打开对话框的代码,...但我无法将 ajax 调用放入:
<script>
$(function() {
$( "#photo_comments_dialog_<?php echo $photo_comment['PhotoComment']['id'] ?>" ).dialog({
autoOpen: false,
width: 500,
modal: true,
title: 'Report Photo Comment'
});
$( "#photo_comments_opener_<?php echo $photo_comment['PhotoComment']['id'] ?>" ).click(function() {
$( "#photo_comments_dialog_<?php echo $photo_comment['PhotoComment']['id'] ?>" ).dialog( "open" );
});
});
</script>
这是链接:
<?php echo $html->link(ucfirst(__('report', true)), 'javascript:void(0)', array('id' => "photo_comments_opener_".$photo_comment['PhotoComment']['id'], 'class' => 'report')) ?>
这是 ID div:
<div id="photo_comments_dialog_<?php echo $photo_comment['PhotoComment']['id'] ?>"></div>
请帮我完成这个,...提前谢谢