jquery - UI Dialog opens multiple times -


I'm clicking the button, if I click on multiple times, the dialog opens twice. I I do not want to have small dialogue, I need to communicate only which is behind similar data is visible in both the dialogs Attach the picture

I am using the code

  $ (document) .ready (function () {$ ("# policyDialog") .HTML (""); $ ('# PolicyDialog'). Dialog ({autoOpen: false,});}); Function on Vividate (policy id) {var policyID = policyID; Var policydetaildialog = ""; var title = "title"; $ ("Loading"). CSS ({'display': 'block'}); $ ('# PolicyDialog') Dialog ({width: 1000, autoResize: false, draggable: false, hide: null, modal: true, height: "auto", maxHeight: 500, maxWidth: 1000, minimum height: 450, minWidth: 450, Title: Closed: Work (e) {//e.preventDefault ();}}); $ .ajax ({type: 'post', url: "xyz.jsp", data: {dataID: policyID}, success: function (feedback) {// $ ("#policyDialog"). Html (response); policydetaildialog ("# Policy dialog") dialog ('open'); // $ ("# policyDialog"). Html (policy_detailogialog); $ ("# policyDialog") .html (feedback);}, data type: " Html ", async: false}); / * $ ("# PolicyDialog"). Dialog ('open'); $ ("# PolicyDialog") HTML (policydetaildialog) return false; * / // $ ("#piritualog"); // $ ('#viewDetail') .prope (enable ', true); }   

I have called this function below

  & lt; Button type = "button" class = "btn" id = "viewDetail" onclick = "onViewDetails ('& lt;% = policy.getPolicyId ()%> gt;'); & gt; View Details & lt; / Button & gt;   

The following is my html

  & lt; div id = "policyDialog" & gt; & Lt; / Div & gt;   

Also check the screenshot below: Enter image details here

You do not need to create a dialog every time you click on the button.

Transfer your communication declaration from the click handler:

  var _PolicyDialog; $ (Document) $ ("(#" PolicyDialog). Html (""); _PolicyDialog = $ ('# policyDialog'). Dialog ({autoOpen: false, width: 1000, autoResize: false, draggable: false, hidden: tap, measurement : True, Height: "Auto", MaxHight: 500, MaxWith: 1000, Minhite: 450, Minweth: 450, Title: Title, Closed: Work (E) {//e.preventDefault ();}}};}) ;   

And in your AJAX function, open communication like this:

  _PolicyDialog.dialog ("open");   

Take a look at

Comments

Popular posts from this blog

java - Joda Time Interval Not returning what I expect -

Member with no value in F# -

javascript - Render HTML after each iteration in loop -