function update(){
var name= document.getElementById("TextBox").value;
$.ajax({
url: '....',
type: 'post',
data: {....//many data include// 'name' : name, ....},
success: function(data) {
var replacevalue=data.replace(/[\[\]']/g,'');
alert(replacevalue);
var stringstatus=replacevalue.replace(/['"]+/g, '');
alert(stringstatus);
if(stringstatus == "success"){
alert ("Successfully Update ")
}
else{
alert("Failed!");
return ;
}
returnToDisplayPage();
},
error: function(xhr, desc, err) {
console.log(xhr);
console.log("Details: " + desc + "\nError:" + err);
}
});
}
function returnToDisplayPage(){
var id = document.getElementById("TextBox").text;
window.location = './DisplayPage.php?Name='+id;
}
請推薦我。點擊更新按鈕並刷新或重新加載頁面時,我應該如何獲取更新的數據?在函數returnToDisplayPage()方法中。我只有更新數據的名稱和其他相關領域的數據沒有回來。如何刷新頁面更新數據時點擊更新按鈕
簡單重裝在阿賈克斯成功功能的頁面類似這樣的窗口.location.reload(); – JYoThI
@JYoThI,我嘗試了嘗試,但它並沒有奏效。 –
你可以在應用程序中使用Jquery嗎?如果你可以,那麼在調用函數時,你可以只加載特定的div。 –