I know that there are many threads for this topic. Searched many of them already several days(!)... getting crazy becuase of this. I checked these: Uncaught TypeError: Object #<Object> has no method 'dialog' Uncaught TypeError: Object [object Object] has no method 'dialog'
Cannot understand what I am doing wrong, need your help. Below is code which I am trying to make work.
Index.chtml
@{
ViewBag.Title = "Home Page";
}
<br/>
<input type="button" value="Get Form" onclick="getForm()" />
<script type="text/javascript">
function getForm(){$('#dialog').dialog({
autoOpen: true,
width: 400,
resizable: false,
title: 'My Table',
modal: true,
open: function(event, ui) {
$(this).load('@Url.Action("Index", "Home")');
},
buttons: {
"Close": function () {
$(this).dialog("close");
}
}
});
}</script>
<div id="dialog"></div>
Controller
public ActionResult _dialog()
{
return View();
}
public ActionResult Index()
{
return View();
}
_dialog.chtml
<h3>Partial View code</h3>
_Layout.chtml
...
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.min.js"></script>
<link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
...