Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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

share|improve this question
1  
Is the problem in IE9? – tsukimi Aug 22 '12 at 7:42
I was so focused on this error I didn't even think to try it in another browser. Yes this error is in IE9. However I have just tried it in Chrome and the dialog opens and closes as it should but the content is never displayed!! – Fred Aug 22 '12 at 7:46
1  
Does this existing question help you? – tsukimi Aug 22 '12 at 7:49
Thanks tsukimi. This workaround did fix this problem! I'm a happy man again! Apologies for not finding it myself. – Fred Aug 22 '12 at 7:59
The happiness is short lived! The workaround fixed the problem above but it has cause a number of other problems on the page including a simple mouseover image swap :s – Fred Aug 22 '12 at 8:29

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.