jquery - show loading div for dialog -
here below code, have loading div named dvloading
, can tell me or how show loading div in open attribute , hide when opened?
$("#dialog-edit").dialog({ title: 'add', autoopen: false, resizable: false, height: height, width: width, /*show: { effect: 'drop', direction: "up" },*/ modal: true, draggable: true, open: function (event, ui) { $(this).load(url); }, close: function (event, ui) { $(this).dialog('close'); } });
thanks
this may work. (not tested) according .load() documentation.
$("#dialog-edit").dialog({ title: 'add', autoopen: false, resizable: false, height: height, width: width, /*show: { effect: 'drop', direction: "up" },*/ modal: true, draggable: true, //this function launched when dialog open. open: function (event, ui) { //show loading div on open. $("#dvloading").show(); //adding callback function wich launched after loading $(this).load(url,function(response, status, xhr) { if (status == "error") { var msg = "sorry there error: "; $(this).html(msg + xhr.status + " " + xhr.statustext); } else $.("#dvloading").hide(); }); }, close: function (event, ui) { $(this).dialog('close'); } });
Comments
Post a Comment