Javery 내에서 doin ajax 호출은 어떻게됩니까? 이 같은.
<button onclick="SomeFunction()" type="button" >Click me</button>
그리고이 같은 JQuery와 뭔가 :
function SomeFunction()
{
var url = '/MyController/MyAction/';
$.ajax({
type: "POST",
url: url,
data: { value: '1234' }, //if there are any parameters
dataType: "html", //or some other type
success: function (data) {
window.location.reload(true);
// or something in that area, maybe with the 'data'
},
error: function() {
//some derp
}
});
내가 미안 당신의 질문을 오해하지 희망 (그리고 나는이 정확히 ajax.actionlink를 사용하지 않는 실현). ;) 감사합니다!
는 ########## 편집을 할 #########
아니면 멀리 가져온 아이디어에 전체 페이지를 래핑 updatetargetid에 대한 링크를 말하고. 뭔가 같은 : 다음
@Ajax.ActionLink("Click me", "MyAction", "MyController", new { value = '1234' }, new AjaxOptions { HttpMethod = "POST", Confirm = "Are you sure ?", UpdateTargetId = "TheDivToUpdate" }, null)
그리고이 div 태그로 페이지의 내용을 포장 :
<div id="TheDivToUpdate">
//The content of your page
</div>
내가 아는, 아니 가장 아름다운 솔루션하지만 어쩌면 그것은 작동 너를 위해서?
궁금한 점, GET 방법에는 어떤 문제가 있습니까? – Dmitry
응용 프로그램의 상태 변경 (레코드 삭제, 상태 변경 ...)과 같은 작업을 수행하는 데 GET 메서드를 사용하는 것은 좋지 않습니다. 여기에 상태를 변경하기위한 actionLink가 필요합니다. 그 이유는 GET을 수행하는 고전적인 html.actionlink를 사용하고 싶지 않기 때문입니다. – Bronzato