jquery
2012-04-14 29 views 0 likes 
0

我基本上把人插入到我的db中,並使用下面的代碼。插入db if(response == ok)我如何顯示添加的人?插入到db後的jQuery

它將人添加到db。但是,我必須顯示添加的人員。如果我使用重新加載它發送主頁面。你有什麼建議?

function AddData(par){ 

    var artistName = $("input[name='"+par+"']").attr('id') + '-'+$("input[name='"+par+"']").val(); 

    $.post('/json/management/AddDataAjax2', 
    { 
     "artistName": artistName 
    }, 
    function(response){ 
     console.log(response); 
     if(response =='ok') 
      alert("Başarıyla eklendi"); 
     else{ 
      alert("Sanatçı bulunamadı, yönlendiriliyorsunuz"); 
      window.location.replace("http://www.sinemalar.com/management/artistAddEditRemove/"); 
     } 
}); 
} 
+0

呃...添加顯示人的代碼,而不是'alert'? – 2012-04-14 10:16:40

+0

你想html端? – 2012-04-14 10:18:35

回答

2

您必須閱讀文檔:http://api.jquery.com/jQuery.post/。 你的迴應可以是任何東西,如HTML,JSON ...

+0

所以發送該名稱作爲迴應。 – 11684 2012-04-14 10:23:46

相關問題