왜 첫 번째 경고가 정의되지 않았습니까? 알림 메시지가 나타나고 텍스트 상자는 알림을 닫을 때만 나타납니다.첫 번째 부분보기 jquery selector.attrib ('id')가 정의되지 않았습니다.
이후 "새"를 클릭 경고 "의 RowId". 경고를 무시하고 나면 두 개의 상자가 보입니다.
다음은 InserterAfter 인 Ajax.Action 링크가있는보기입니다.
@Ajax.ActionLink("New", "_New", new { Controller = "Test" }
, new AjaxOptions()
{ InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "divNew" })
<div id="divNew" />
여기 내 부분보기입니다. 보통 오래된 jQuery를
<!-- TODO: This script should be moved to a separate javascript file
because you should never mix markup and javascript. But for the
purpose of this demonstration I have left it in the view
-->
<script type="text/javascript">
var onSuccess = function (result) {
$('#divNew').append(result);
};
</script>
@Ajax.ActionLink(
"New",
"_New",
new { controller = "Test" },
new AjaxOptions() { OnSuccess = "onSuccess" }
)
<div id="divNew" />
또는 멀리 Ajax.*
도우미를 던져 및 사용 :
RowId: @Html.TextBox("RowId")<br />
<script language="javascript">
$(document).ready(function()
{
alert($('input[name="RowId"]').attr('Id'));
});
</script>
+1에 대한 조언 : –
감사합니다. 나는 모든 js를 분리 할 것이다! –
내가 제안하는대로 jquery ajax와 함께 갈 것입니다. .js 파일을보기에 대한 코드와 같이 사용할 계획입니다. –