[英]Not able to refresh the partial view after a form submission from another partial view within it, using ajax in mvc razor
[英]Refresh conent with JQuery/AJAX after using a MVC partial view
使用以下JQuery / AJAX函數,當在名為“ ReportedIssue”的組合框(也位於部分視圖)中更改選項時,我將調用部分視圖。 名為“ tableContent”。
<script type="text/javascript">
$(function() {
$('#ReportedIssue')
.change(function() {
var styleValue = $(this).val();
$('#tableContent').load(
'/CurReport/TableResults',
{ style: styleValue }
);
})
.change();
});
</script>
我的問題是,跳轉到部分視圖后,我失去了指向javascript的鏈接。 我認為我應該使用JQuery“ .live()”,但不確定。
簡而言之,在包含部分視圖的HTML之后,我想重新建立我的JavaScript和組合框之間的鏈接。
我希望我已經足夠清楚了,
亞倫
由於.live()現在已被棄用。 使用.on()。 或者,在我的成功回調中,我只是做了一個.load() $('#container').load('index.php', '#right');
像魅力一樣工作。
是的,您應該使用live():
$('#ReportedIssue').live('click', function() {
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.