开发者

jquery unspecified error IE

So, IE is giving me issues, surprise, surprise...

I create a jquery dialog box (Div3) and then inside div3, i display a table (Div4). This works fine in firefox. However, in IE it is not displaying div 3, the popup window. Instead it returns the error "Unspecified error," and only displays div4, the table. Code is below...

I believe the error is somewhere in the else statement.

Any help is appreciated. Thanks!

function displayMid(count) {
        var x = $("#Pid"+count).text();
        var y = $("#PidSeries"+count).text();
        //alert(x);
        if (x == 0) {
            return;
        }
        else if (y == null || y == " " || y == "") {
            $("#inputDiv3").html("").dialog('destroy');
            $("#inputDiv3").dialog({
                titl开发者_StackOverflow社区e: 'You must add the Product before you can assign catalogs!!!',
                width: 500,
                modal: true,
                resizable: false,
                buttons: {
                    'Close': function() { $(this).dialog('close'); }
                }
            });
        }
        else {
        $("#inputDiv3").dialog('destroy');
        $("#inputDiv3").html('<div style="height:300px;overflow-y:scroll;"><div id="inputDiv4"></div></div>').dialog({
            title: 'Catalog for ' + $("#PidTitle"+count).text(),
            width: 500,
            modal: true,
            resizable: false,
            open:   $.get('content_backend_pub_pid.ashx', { cmd: 4, pid: x }, function(o) {
                        $("#inputDiv4").html(o);
                    }),
            buttons: {
                'Close': function() { $(this).dialog('close'); }
            }
        });

        }

    }


Not sure about this but I think you should wrap the ajax call for open: in a anonymous function.

open: function(){ 
            $.get('content_backend_pub_pid.ashx', { cmd: 4, pid: x }, function(o) {
               $("#inputDiv4").html(o);
            });
},


Usually IE specifies a line number for the error. You have a lot going on in there, try breaking down each part into its own statement on a separate line. You can then throw in console logs between each line as well.

In general I like to create a new variable and assign that to the property, or create a new local function if the property is a function.


The issue seems to be in your open function. Maybe try wrapping that in an anonymous function like so:

        $("#inputDiv3").html('<div style="height:300px;overflow-y:scroll;"><div id="inputDiv4"></div></div>').dialog({
            title: 'Catalog for ' + $("#PidTitle"+count).text(),
            width: 500,
            modal: true,
            resizable: false,
            open:   function() {
                        $.get('content_backend_pub_pid.ashx', { cmd: 4, pid: x }, function(o) {
                            $("#inputDiv4").html(o);
                        });
            },
            buttons: {
                'Close': function() { $(this).dialog('close'); }
            }
        });

Otherwise, the "get" will fire immediately as opposed to when you actually open the dialog.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜