jquery - bound event handler not firing modal dialog button click -
jquery - bound event handler not firing modal dialog button click -
i have scenario me sounds so post , others have asked similar....only i'm not understanding others have gotten these post implementation partially failing.
basically have page button adding new record. click add together button , modal dialog opens. modal dialog different view parent page of course of study fields needed creating record.
clicking save (remember save button on modal want save event fire never does...nor errors reported in dev tools or fiddler. here code launching modal , in comments see how far get.
$(document).ready(function () { $("#new").click(function (e) //attach new button works great { e.preventdefault(); //seems work var ischanging = false; //hard coded vars testing var financierid = 0; var detailswindow = $("#window").data("kendowindow");//handle if existing window if (!detailswindow) { // create new window, if there none on page detailswindow = $("#window") // set content 'loading...' until partial loaded .html("loading...") .kendowindow( { ....removed options brevity }) .data().kendowindow.bind('refresh', function (e)//attach refresh { alert('bound'); //this alert displays after modal loads $('#save').click(function (event) { alert('dqewewr'); //this alert never fires nor subsequent event.preventdefault(); // take on , perform ajax post alert('parent'); $.ajax( { type: "post", url: "@html.raw(url.action("createedit", "finance"))", data: $(this).serialize(), success: function (data) { //here check if called resulted in success/failure if (data.result === "success") { alert('finis'); } else { //show error message or whatever. } } }) }); }).center(); } detailswindow.open(); }); });
my modal not wrapped in form tag...didn't think need if i'm using ajax post...?
<span id="save" class="k-button" style="margin-right:10px;">save</span>
finally create sure clear. parent page configure.cshtml , modal createedit.cshtml....in other words while modal beingness generated nail controller it's work returns createedit view populated model accordingly.
this has frustrated me week , while have been able work on other items in between coming head 1 of lastly things before completion of task.
thank much help.
stephen muecke...if see alter comments reply , mark solved problem me.
jquery asp.net-mvc-4 modal-dialog
Comments
Post a Comment