iframe在设置src属性时调用Action方法两次
iframe calls Action method twice while setting src attributes
我正在通过iframe从控制器端调用action方法。SRC属性,它返回部分视图,但调用了两次原因是什么谁能帮我解决这个
在这里找到我的代码
$('#testdailog').dialog({
autoOpen: false,
title: 'Split Fax',
height: 'auto',
width: '80%',
position: ['top', 50],
draggable: false,
show: 'blind',
hide: 'blind',
modal: true,
open: function (event, ui) {
var frameSet = document.getElementById("testdailogFrame");
frameSet.src='@Url.Action("TestPage", "Fax")';
},
close: function (event, ui) {
var frameSet = document.getElementById("testdailogFrame");
frameSet.src="about:blank";
});
通过更改iframe内容更改的代码而不是SRC属性
解决了这个问题 $('#testdailog').dialog({
autoOpen: false,
title: 'Split Fax',
height: 'auto',
width: '80%',
position: ['top', 50],
draggable: false,
show: 'blind',
hide: 'blind',
modal: true,
open: function (event, ui) {
$.ajax({
url: '@Url.Action("TestPage","Fax")',
type: 'GET',
cache:false,
success: function(data){
var frameSet = document.getElementById("testdailogFrame");
var iframedoc = frameSet.document;
if (frameSet.contentDocument)
iframedoc = frameSet.contentDocument;
else if (frameSet.contentWindow)
iframedoc = frameSet.contentWindow.document;
if (iframedoc){
iframedoc.open();
iframedoc.writeln(data);
iframedoc.close();
}
},
error: function () {
window.location.href = '@Url.Action("Index","Error")';
}
});
},
}
});
相关文章:
- Meteor Router数据函数被调用两次
- 从MySQL数据库中获取输入数据需要两次页面刷新
- Module.start()已激发两次
- jQuery 方法调用了两次
- 为什么 POST 方法将表单数据发送到服务器两次
- 在AngularJS中,一次进行两次调用是一种可接受的方法
- 有没有一种不那么黑客的方法可以防止我的 on('click') 触发两次
- 使用两次点击方法
- C 节点本机扩展调用方法两次
- 如何在rails3ajax表单中两次使用jQuery-submit方法
- 为什么是动能.形状'的drawFunc方法调用了两次
- 必须点击两次做一个方法在React
- iframe在设置src属性时调用Action方法两次
- $scope's方法通过ng-click调用:由IE执行两次
- 方法调用两次在第二次运行- JavaScript
- 防止同一个触发器函数执行两次的最好方法是什么?
- 使用T3JS框架时,最好的方法是两次使用相同的模块
- 当两次调用一个方法时,仅呈现一个SVG组件
- window.open两次不起作用(第二个窗口没有出现)-Blocker解决方法
- 方法的一部分调用了两次