我有一些Zend框架和AJAX的麻煩。ZF阿賈克斯一般如何
在視圖中,我有一個帶有製表符的div。當我點擊UnitTab「#tabUnits」時,單元視圖將顯示一個項目列表。還有一個鏈接來添加新的單位,所以添加視圖加載到選項卡。
的鏈接添加一個單位是:
<a id="addUnit" href="idBuilding/<?= $this->idBuilding ?>" href="#"><img width="16" height="16" src="/images/icons/fugue/plus-circle-blue.png"></a>
和Ajax調用是:
$(document).ready(function(){
var url = '/unit/add/'+$("#addUnit").attr('href');
// ADD
$("#addUnit").click(function(event){
event.preventDefault(); // link is not executed
$.ajax({
url: url,
type: 'GET',
success: function(data) {
$("#tabUnits").html(data);
},
error: function(){
alert('An error occurred, please check before continue...');
}
});
});
});
當沒有發生錯誤添加單位,並再次顯示列表。
當我想編輯一個單元時,如何知道該id正在改變?
不能得到你正在嘗試做的 – emaillenin 2012-01-07 19:57:15