I am fairly novice with JQuery. I am using the Dialog box to popup a window that displays a page from an external site.
<script type="text/javascript">
$.fx.speeds._default = 400;
jQuery.support.cors = true;
$(function ()
{
$("#cmdLaunchInDiv").click(function ()
{
$("#dialog-modal").dialog({
autoOpen: false,
height: 845,
width: 820,
show: "scale",
hide: "scale"
});
$.ajax({
url: 'http://www.mycompany.com/geturl/?userid=' + document.getElementById("txtUserId").value,
dataType: 'json',
success: function (data)
{
$('#dialog-modal').html("<iframe id='iFr' style='height:800; width:800; overflow: hidden;' height='800' width='800' scrolling='no' src='" + data + "'>");
}
});
$("#dialog-modal").dialog("open");
return false;
});
});
<div id="dialog-modal" title="My Page" >
</div>
The Ajax call gets the URL I want to load based on the userid. if I do not use the line jQuery.support.cors = true; the Ajax call does not work, I am not sure why the line fixed that problem but my searching suggested it would.
The problem is that when I first run the page all works fine. I enter my userid click the button the div opens and the page loads as expected. I then close the dialog using the built in close X on the top right of the dialog box and the box closes as expected. However if I try to open the dialog again I get an error in JQuery-1.8.0.js
Microsoft JScript Runtime Error: 'Array' is undefined
// Save a reference to some core methods
core_push = Array.prototype.push, //<=== This line
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
core_toString = Object.prototype.toString,
core_hasOwn = Object.prototype.hasOwnProperty,
I cannot find anything to help me find out what the problem is and have rewritten my Jquery a number of times.
UPDATE: This error is in IE9. In Chrome and Firefox the dialog box opens and closes correctly but the content is not displayed unless the page I am trying to load in on the same domain.
Can anyone point me in the right direction please?
Many Thanks
Fred