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,
- Clicking on the popup opens
- 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 This is how you line or submit callback: The koList
and data variables are local.
_deleteImage
is to use jQuery to stores that are trying to add data on DOM node model:
$ ('# deleteModal'). Data ('_tmpData', {koList: koList, data: data});
function () {var tmpData = $ (this) Kdeta ( '_ tmpData'); _deleteFile (tmpData.koList, tmpData.data); $ (This) .dialog ("off"); }
Comments
Post a Comment