@Ajax.ActionLink("new game", "Game",null, ajaxMainArea,new { @id="aNewGame" })
그리고이 기능을 요소에 바인딩하십시오.
$(function() {
$("#aNewGame").click(function (e) {
e.preventDefault();
$.get("YourController/ActionMethod", { yourData: "someValue" }, function (response) {
//Do whatever with the reponse.
});
});
});
페이지에 jQuery가로드되어 있다고 가정합니다. 나는 그런 링크가 일부 사용자 지정 물건을하고있는 경우
, 난 그냥 일반 ActionLink
HTML 도우미를 사용하여이
@Html.ActionLink("new game", "Game",null,new {@id="aNewGame"})
처럼 그에게 기능을 결합하고 스크립트가
$(function() {
$("#aNewGame").click(function (e) {
e.preventDefault();
$.post("YourController/ActionMethod", { yourData: "someValue" }, function (response) {
$("#main_area").html(response);
//If you want to do something else, you can do it here. :)
});
});
});
입니다 것입니다