javascript - Delete confirmation - pass data from html when modal popup is opened -


I have a deleted confirmation popup that has been opened on the click of the deleted link.

My HTML:

  & lt; Div id = "deleteModal" & gt; & Lt; P & gt; Are you sure & Lt; / P & gt; & Lt; / Div & gt; & Lt; Ul data-bound = "foreach: activelist" & gt; & Lt; Li class = "add ICN" data-bind = "click: function () {$ root.deleteFileAsset ('image', $ data);}" & gt; & Lt; A data-bind = "click: function () {$ root.deleteImage ('image', $ data);}" & gt; & Lt; Img src = "../../ css / images / delete." / & Gt; & Lt; / A & gt; & Lt; B data-bind = "text: title" & gt; & Lt; / B & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

My JS files do (such as clicking on the I deleted, called the method below):

  var _deleteImage = function (colist, data) {window.event.cancelBubble = true; $ ('# DeleteModal') dialog ("open"). } // modal popup is opened with the code ready function / set function // $ ( '# deleteModal') Ksnwad ({autoOpen: false, modal: true, width: 628.73, height: 328.38, button : {'Submit': function {_deleteFile} ($ {this ($)) .dialog ("close" );}}}); // This function is called in the click of the model popup _deleteFile (koList, data) {code for deletion goes here}  

Now what happens here,

  1. Clicking on the popup opens
  2. When I click on Submit, it throws an error: is notified '.

I need to confirm the confirmation of the data and the callist to remove. Because that particular data is used in the removal method.

You need to store the data that you want to have, like The koList and data variables are local.

This is how you line _deleteImage is to use jQuery to stores that are trying to add data on DOM node model:

  $ ('# deleteModal'). Data ('_tmpData', {koList: koList, data: data});  

or submit callback:

  function () {var tmpData = $ (this) Kdeta ( '_ tmpData'); _deleteFile (tmpData.koList, tmpData.data); $ (This) .dialog ("off"); }  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -