2017-01-06 144 views
1

我想展示功能的成功,而不是這個bootstrapDialog箱顯示按鈕

我需要這個按鈕,以適應在我<div class="tilting"></div>而不是顯示頁

+0

誰能幫助我? – john

+0

您能否提供一部分代碼來調用ajax請求? – DokiCRO

回答

0
上其他地方的後一個按鈕「刷新遊戲」

你需要下面的代碼使用方法的成功裏面,

document.getElementsByClassName("tilting")[0].innerHTML="<button type="button">Reload Game</button>"; 

如果您正在使用jQuery的Ajax試試下面的方法吧,

function loadDoc() { 
    $.ajax({ 
    type: 'POST', 
    url: 'APUC', 
    data: 'productName=' + productName, 
    dataType: 'html', 
    cache: false, 
    success: function (result) { 
     document.getElementsByClassName("tilting")[0].innerHTML="<button type="button">Reload Game</button>"; 
     }, 
    }); 
} 

如果使用純阿賈克斯,嘗試這樣的:

function loadDoc() { 
     var xhttp = new XMLHttpRequest(); 
     xhttp.onreadystatechange = function() { 
     if (this.readyState == 4 && this.status == 200) { 

     document.getElementsByClassName("tilting")[0].innerHTML="<button type="button">Reload Game</button>"; 

     } 
     }; 
     xhttp.open("GET", "ajax_info.txt", true); 
     xhttp.send(); 
    }