-4
我正在使用codeigniter。當我使用網站UI更新數據庫值時,它會在數據庫中更新,但在用戶界面上它只顯示舊值。刷新頁面後,它顯示更新的值。 請建議解決方案相同。 謝謝。Codeigniter:未顯示更新值
我正在使用codeigniter。當我使用網站UI更新數據庫值時,它會在數據庫中更新,但在用戶界面上它只顯示舊值。刷新頁面後,它顯示更新的值。 請建議解決方案相同。 謝謝。Codeigniter:未顯示更新值
您需要使用AJAX。類似這樣的:
data = {"slug" : slug};
$.ajax({
url: '', //url of controller where you would update the code using model
method: 'POST', //method
data: data, //data to be updated
dataType: 'json',
contentType: 'json'
})
.done(function(res){ //Upadte html; Note the data in 'res' variable is the data which your above 'url' would echo
})
.fail(function(res){//handle here if error occured
});
希望這是您學習AJAX的好起點。如果您向我們提供一些代碼,我會幫助您更多。
您應該向我們提供更多信息,以幫助您解決問題。告訴我們你的代碼... :) – sotoz