开发者

Access Denied error jQuery .load

I have a page that loads a div from another page on successful submission of a form. It works in all browsers except IE 7 and 8 where I get the following error:

Here is the error code: Error: Access Denied

my code:

$("#formTwo").validate({
        groups: { asset: "trade_futures trade_fx trade_equities" },
        errorElement: "em",
        errorPlacement: function(error, element) {
            error.appendTo(element.parent("li"));
        },
        submitHandler: function(form) {
            $("#processing").show();
            var dataString = $(form).serialize();
                $.ajax({
                    type: $(form).attr('method'),
                    url: form.action,
                    data: dataString,
                    success: function(data, status) {
                         $("#currentUser, #newUser, #submitContain, #processing").hide();
                         $("#contain").load('download-download #req');
                    },
                    error: function (data, status) {
                        $("#newUser, #submitContain").hide();
                        $("#contain").html("error");
                    }
                });
            return false;
           },
       //rest of rules and messages

I have seen a lot of discussion a开发者_如何转开发bout this but none of the solutions seem to work. I have tried loading from google cdn, microsoft cdn, jquery cdn and from a local copy of jquery-1.4.2.js but nothing works!

Is there an alternate way you use to load a div from another page on success?


The form action you are using to get the url for the ajax method (.load) is that of another domain namely "http://www.ninjatrader-support2.com/sugar/Nt6.5Lead.php.

You cannot do ajax calls cross domain. You are following foul of the same origin policy.

The simplest way to see is open the IE debugging tool and select the script tag and press start debugging. Fill in the form fields and click download, the debugging tool will kick in and show you the following

Access Denied error jQuery .load

Notice the url in the watch window on the right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜