我有一個網站,currenty使用原型,即時嘗試擺脫。這是使用它的唯一3個功能。原型轉換ajax.updater
我一直在嘗試所有的早晨來轉換這些,但由於我對jquery的理解並不是很好,所以很掙扎。
function GetCountries() {
new Ajax.Updater('country_list','site_countries.php', {parameters: '&onchange=1', onComplete: GetRegions});
}
function GetRegions() {
new Ajax.Updater('region_list','site_regions.php', {parameters: '®ionID='+$('regionID').value+'&countryID='+$('countryID').value+'&onchange=1', onComplete: GetTowns});
}
function GetTowns() {
new Ajax.Updater('town_list','site_towns.php', {parameters: '®ionID='+$('regionID').value+'&countryID='+$('countryID').value});
}
這是我想出了,但它不工作:
function GetCountries() {
$.ajax({
type: "POST",
url: "site_countries.php",
data: '&onchange=1',
success: function(transport){
$('#country_list').html(transport.responseText)
GetRegions
}
});
}
即調用只是返回的頁面上替代了一個跨度稱爲COUNTRY_LIST內,那麼它選擇下拉列表中選擇頁面calles GetRegions是這樣做的。
任何援助將大大收到!
史蒂夫
你檢查什麼樣的錯誤它給?如果你使用Firefox並且使用FireBug,只需按'F12'獲取開發人員選項,那麼在控制檯中你可以看到它給出了什麼錯誤。 – Amar