Reputation: 734
I am new to jQuery UI. I wrote the following code as a part of ASP.NET MVC project, and I am not sure why the dialog isn't getting closed. I tried so many things but it just seems to be not working. Can anyone help?
$(document).ready(function () {
$(function () {
$("#flightModal").dialog({
title: 'Flight Quotations',
autoOpen: false,
resizable: false,
width: 700,
height: 450,
modal: false,
draggable: true,
context: $(this),
open: function (event, ui) {
$(".ui-dialog-titlebar-close").hide();
$(this).load(url);
},
buttons: {
"Cancel": function () {
$("#flightModal").dialog('close');
}
}
});
$("#createFlight").on("click", function (e) {
url = "/Quotations/QuotationsFlight"
$("#flightModal").dialog('open');
return false;
});
}); });
I tried destroy, remove and all other solutions described in other stackoverflow questions. I believe I am missing a simple thing, but couldn't figure it out so far.
Upvotes: 1
Views: 75
Reputation: 3305
$(document).ready(function () {
$(function () {
The below two lines are the same. Try to remove the following layout. It should work.
$(function () {
});
Something like this,
$(document).ready(function () {
$("#flightModal").dialog({
title: 'Flight Quotations',
autoOpen: false,
resizable: false,
width: 700,
height: 450,
modal: false,
draggable: true,
context: $(this),
open: function (event, ui) {
$(".ui-dialog-titlebar-close").hide();
$(this).load(url);
},
buttons: {
"Cancel": function () {
$("#flightModal").dialog('close');
}
}
$("#createFlight").on("click", function (e) {
url = "/Quotations/QuotationsFlight"
$("#flightModal").dialog('open');
return false;
});
});
Upvotes: 1