Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdate a div with results of a jqModal ajax call from MVC page
    primarykey
    data
    text
    <p>Here's my scenario. </p> <p>I call jqModal using its ajax functionality that displays a form in the modal dialog. The user fills out some information and submits the form which returns some html in response.</p> <p>The resulting html is being displayed inside the jqModal div. The user then clicks Close to dismiss the modal dialog.</p> <p>This all works correctly so far.</p> <p>Instead, what I want to do is close the dialog on submit and update a div with the response from the server.</p> <p>Calling code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#jqmWindowContainer').jqm({ modal: true, ajax: '.... url to display my form ...', onHide: myAddClose, ajaxText: 'Loading', toTop: true, }); function myAddClose(hash) { hash.w.fadeOut('300', function () { hash.o.remove(); }); } }); &lt;/script&gt; </code></pre> <p>Calling page's markup. Clicking "Save this search" triggers the dialog.</p> <pre><code> &lt;a href="#" class="jqModal"&gt;Save this search&lt;/a&gt; &lt;span id="jqmWindowContainer" class="jqmWindow"&gt;&lt;/span&gt; </code></pre> <p>Form that is displayed:</p> <pre><code> &lt;div class="jqmPopupForm" id="jqmPopupForm"&gt; &lt;div id="loadingMessage" style="display: none;"&gt; Saving... &lt;/div&gt; &lt;% using (Ajax.BeginForm("Save", "AssetSearch", new AjaxOptions() { HttpMethod = "Post", InsertionMode = InsertionMode.Replace, UpdateTargetId = "jqmPopupForm", LoadingElementId = "loadingMessage" })) {%&gt; .... some html input elements go here ... &lt;input type="submit" value="Save Search" /&gt; &lt;a class="jqmClose" href="#"&gt;Cancel&lt;/a&gt; &lt;% }%&gt; &lt;/div&gt; </code></pre> <p>Right now, the entire jqmPopupForm div is being replaced by the results of the form submit.</p> <p>How can I close the dialog and update a div on the page instead of making the user dismiss the dialog?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload