我有以下javascript:
$.post("/Authenticated/DeletePage/" + PageId);
showStatus("Page deleted...", 10000);
我希望传递$ .post()调用返回的showStatus()文本,而不是硬编码文本。我该怎么做?
答案 0 :(得分:3)
$.post("/Authenticated/DeletePage/" + PageId, function(data){
showStatus( data + " deleted...", 10000);
});
和JSON
$.getJSON("/Authenticated/DeletePage/" + PageId, function(data){
showStatus( data.pageName + " deleted...", 10000);
});
答案 1 :(得分:0)
$.post("/Authenticated/DeletePage/" + PageId, function(JSONdata) {
showStatus(JSONdata.Name + " deleted...", 10000); //This is just to show you, signature is different
});
请参阅此处的jQuery文档:http://api.jquery.com/jQuery.post/