Search code examples
jqueryasp.nettabsuploadify

Jquery Tabs and Uploadify Object Expected


I am using uploadify plugin inside jquery tabs which works perfectly fine. Inside the uploadify once upload is completed i am sending email as such :

 $('#file_upload').uploadify({
                'fileTypeDesc': 'Image Files',
                'fileTypeExts': '*.gif; *.jpg',
                'swf': 'Scripts/Uploadify/uploadify.swf',
                'uploader': 'FileUploadHandler.ashx',
                'cancelImg': 'Scripts/Uploadify/uploadify-cancel.png',
                'buttonText': 'Browse',
                'onQueueComplete': function (queueData) {
                senEmail();
                }
            });

My sendEmail function is in Ready function of the page as below:

var senEmail = function() {
                var notes = $("#<%=txtMessage.UniqueID%>");

                var msgbox = $("#cerror");
                $("#cerror").hide();
                $.ajax({
                    type: "POST",
                    url: "ContactMe.aspx/SendEmail",
                    data: "{'message': '" + notes.val() + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",

                    success: function (msg) {
                        if (msg.d == 'Sent') {
            var $tabs = $('#tabs').tabs(); // declare the tabs
            $tabs.tabs("url", 5, "/ContactConfirmation.aspx"); // change the URL of the selected tab
            $tabs.tabs("select", 5 + 1); // refresh the tab content
alert("masTEST3");
            $tabs.tabs("select", 5 ); // refresh the tab content
alert("endTEST");
                        }
                        else {
                            $("#cerror").show();
                            msgbox.html(msg.d);
                        }
                    }

                });
            };

Now the above works fine as in sends an email, but when I am forwarding the user to confirmation page, I get the jquery error : Object Expected and does not forward to next page on same tab(this works on other pages).

appreciate your help.

EDIT:::

here is the IE9 error :

SCRIPT5007: Object expected 
jquery-1.8.3.min.js, line 2 character 24275

and the debugger is on this line:

return!t||t!==!0&&e.getAttribute("classid")===t}})

Solution

  • Found the solution in case someone else has same problem:

    I had to destroy the uploadify object when the tab was changing/reloading so all I had to do was before sending email include this line :

    $("#file_upload").uploadify("destroy");