javascript - Refresh a section of a parent page when a child modal popup closes -


i stuck @ issue, , have been ramming head, seems pretty viable , easy ain't clicking right now.

i have mvc6 view, composed of various partials. on 1 of partials, have anchor tag:

@model modela <div>    @html.textboxfor(m=>m.id)    <a onclick="bookproduct();" style="pointer:cursor">book product</a> </div> <div id="divmodalbody" class="modal fade" tabindex="-1" role="dialog">    <div id="divmodalpopup">    </div> </div>  <script>    function bookproduct()    {       $.ajax({          url:'controller1/bookproduct',          type:'get',          datatype:'html',          data:some sample data,          success:function(result)            {              if(result!=undefined)                {                  $("divmodalbody").html(result);                }            },          error:function(xhr)            {              console.log(xhr);            }         });      } </script> 

this bookproduct() function calls controller method , shows result in modal popup via ajax call.

i perform operations in popup , click on save.

the data validated , saved db, control comes success part of modal popup.

i close popup , need refresh partial of parent page , maybe bind list. 

how make parent page understand popup work has been completed , partial view needs refreshed?

please guide.

from controller must use return partialview rather return jsonresult.


Comments