Mr. Ant
Mr. Ant

Reputation: 700

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({
                title: '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'); }
            }
        });

        }

    }

Upvotes: 2

Views: 6813

Answers (3)

Silkster
Silkster

Reputation: 2210

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.

Upvotes: 0

Mikael Eliasson
Mikael Eliasson

Reputation: 5227

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);
            });
},

Upvotes: 4

Jason
Jason

Reputation: 2741

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.

Upvotes: 1

Related Questions