asp.net/jQuery:后数据用jQuery来弹出[IE] [英] asp.net/jQuery: post data with jQuery to a popup [IE]
问题描述
我想在一个asp.net应用程序弹出后使用jQuery数据。
I'm trying to post data with jQuery in an asp.net application to a popup.
如果弹出的打开,我得到三个错误。
第一个错误是:
If the popup opens, I'm getting three errors. The first error is:
Errror: the value of the property is null or undefined not a function object
的(错误code [code在弹出的网站]:HTTP://www.suckmypic.net/26449/e65f2d77.png,
原稿。 code [code在弹出的网站]:HTTP://www.suckmypic.net/26450/7dfdf013.png)的
然后我得到两个错误
的这是正确包括私有函数。
then I'm getting two errors
of private functions which are included correctly.
然后 - 如果我的重新加载在弹出的窗口,一切工作正常
Then - if I'm reloading the popup window, everything is working fine.
我用这种方法打开弹出:
I open the popup in this way:
$.post('popup.aspx', { X: $("#X1").val(), XX: varX, XXX: varXY, Z: varZ}, function (result) {
hWndHelp = window.open('', 'help', cStyle);
hWndHelp.focus();
hWndHelp.document.open();
hWndHelp.document.write(result);
hWndHelp.document.close();
});
的(它存储在我打电话的pressing这是工作的罚款F1键功能)的
我引用了炫魅,并在弹出的窗口我的所有功能和jQuery库。
I'm referencing in the mainpage and in the popup window all my functions and the jquery library.
的修改的
在code为 cStyle
VAR:
The code for the cStyle
var:
var WIN_STYLE_RESIZE =
'resizable = yes, ' +
'status = yes, ' +
'scrollbars = yes';
var cStyle =
WIN_STYLE_RESIZE + ', ' +
'width = ' + w + ', ' +
'height = ' + h + ', ' +
'top = ' + y + ', ' +
'left = ' + x;
的(W,H,Y,X的计算数字,立足于窗口大小)的
如果我只是将其更改为宽度= 600,高度= 400'
,仍然出现错误。
If I change it simply to 'width=600,height=400'
, the error still occurs.
如果我通过 GET
送我的变量,它也可以,但我需要隐藏在URL中的变量。
If I send my variables via get
it also works, but i need to hide the variables in the URL.
工作获取方式:
var getUrl = "popup.aspx?X="+$('#X1').val()+"&....";
hWndHelp = window.open(getUrl, 'help', cStyle);
的另一个编辑:的
只是尝试Chrome和Firefox - 没有错误出现。但是,我需要code一起工作的 IE
推荐答案
所有感谢的答复第一。
我试过所有的答案,但我仍然总是在Internet Explorer中的错误。
I've tried every answer, but I'm still always get the errors in internet explorer.
我已经找到了解决办法,但它不会让我高兴,因为我觉得产生输入字段的新形式是太多了我的需求。
I've found a workaround, but it does not make me happy because i think generating a new form with input fields is too much for my needs.
由于这是张贴我的数据转换成没有得到jQuery的错误弹出一个唯一的选择工作,我决定使用它。
Since it's the only working option for posting my data into a popup without getting the jQuery error, I've decided to use it.
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("action", "popup.aspx");
form.setAttribute("target", "help");
var input = document.createElement("input");
input.type = "hidden";
input.name = "X";
input.value = $("#X").val();
form.appendChild(input);
var input2 = document.createElement("input");
input2.type = "hidden";
input2.name = "XX";
input2.value = varX;
form.appendChild(input2);
var input3 = document.createElement("input");
input3.type = "hidden";
input3.name = "XXX";
input3.value = varXY;
form.appendChild(input3);
var input4 = document.createElement("input");
input4.type = "hidden";
input4.name = "Z";
input4.value = varZ;
form.appendChild(input4);
document.body.appendChild(form);
hWndHelp = window.open("about:blank", "help", cStyle);
hWndHelp.focus();
form.submit();
document.body.removeChild(form);
的原始出处:的
的http://taswar.zeytinsoft.com/2010/07/08/javascript-http-post-data-to-new-window-or-pop-up/
这篇关于asp.net/jQuery:后数据用jQuery来弹出[IE]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!