<ul id="months">
<?php foreach ($months as $key => $value) { ?>
<?php if ($key != 0 && array_key_exists($key, $monthArray) && date("m") > $key) { ?>
<li id="<?= $key ?>"><a href="#" rel="nofollow"><?= $value ?></a></li>
<?php
}
}
?>
下面
是jQuery代碼
$("#year").change(function(){
// alert($(this).val());
$.ajax({
type: 'get',
url: 'ay/templates/frontend/_previous_months.tpl.php',
data: 'year=' + $(this).val(),
success: function(data) {
$("#months").html(data);`
}
});
});
問題:當我第一次請求部分我得到正確的結果,但是當我拿到個月後部分我不能訪問它的jquery,
下面是我需要訪問後,當我得到我的parial(作出上述AJAX調用之前,我可以訪問下面的jQuery功能時,我對李項點擊)
$("#months li").click(function(){
alert("aaaaaaaaaaaaaaaaaaa");
$.ajax({
type: 'get',
url: 'ay/templates/frontend/_previous_charities.tpl.php',
data: 'month=' + $(this).attr("id") + '&year=' + $('#year').val(),
success: function(data) {
if(data == 'false'){
$("#charity_result").html("No previous charity in selected Month");
}else{
$('#charity_result').fadeOut('slow');
// $('#ajax-result').fadeIn('slow');
$('#charity_result').fadeIn('slow');
$("#charity_result").html(data);
}
}
});
});
感謝的人,它只是工作,接受你的答案,再次感謝 – Khurram
你能比點擊接受按鈕嗎? – frietkot
我點了它,但一個消息appaeard說你可以在15分鐘內接受, 對不起隊友;-) – Khurram