0

I am trying to open a url in modal window but i am getting the following error message: Uncaught TypeError: Object [object object] has no method 'dialog'. Below is my code.

function()
{
   var id = $("#grid").jqGrid('getGridParam','selrow'), 
  data={};
  if(id) 
  {
       data = {assetID:id};
  }
   else 
  {
     alert('Please select a row to edit');
     return;
  } 
   var ajaxDialog = $('<div id="ajax-Dialog" style="display:hidden" title="New Work Order"></div>').appendTo('body');
   ajaxDialog.load('forms/mwoForm.php',
       data,
       function(response, status)
       {
           ajaxDialog.dialog(
           {
               width: 'auto',
               modal:true,
               open: function(ev, ui)
               {
                  $(".ui-dialog").css('font-size','0.9em');
               },
               close: function(e,ui) 
               {
                   ajaxDialog.remove();
               }
           });
        }
    );
}

1 Answers1

0

I've seen this issue a couple of times and it is usually linked to referencing jQuery twice.

This thread can give more explanation: Have you seen this solution: Uncaught TypeError: Object [object Object] has no method 'dialog'

Edit: Dialog is a widget and does need to be included:

 <script type="text/javascript" src="jquery.ui.dialog.js"></script> 

or if you want to load the jQuery UI:

 <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>

Can't see all of your code, but make sure that it has been included.

Community
  • 1
  • 1
sbatson5
  • 648
  • 11
  • 19