0
我是0123PO的新手,Jquery
& PHP
。 我被困在代碼中,我希望有人能指導我解決這個問題:使用jquery ajax從動態href中獲取值php
<script type="text/javascript">
$(document).ready(function(){
$('#number_filters a').bind("click", function() {
var year = $(this).attr('href');
$.post('getdata.php',{resultyear:year},function(res){
$("#showresult").html(res);
});
return false;
});
});
</script>
Following code, if anyone click on link below, I am send a value by POST method to a php page and the returned data are displayed in DIV Tag:
<div id="number_filters">
<a href="1" class="c1">Link 1</a>
<a href="2" class="c1">Link 2</a>
</div>
this is the div tag I use to display results from above code:
<div id="showresult"></div>
Up until now it has been working fine, and below is the output which I get from dynamic page:
Output: 2015 2014 2013 2012 2011
現在的問題是,如果任何一個點擊2015年或2014年我想再次顯示動態數據檢索的數據庫。
任何人都可以給我一些想法或代碼,我可以嘗試解決這個問題嗎?
嗨Jogesh,讓我試試這個PLZ .... – user3106824
你好Jogesh,謝謝你Sooooooooooooooo很多提供良好的邏輯,上帝保佑你我親愛的.... – user3106824
@ user3106824高興地幫助你:),節日快樂 –