javascript - View not refreshing after pop-up triggers Action -


i’m building mobile application ipad using mvc4 , jquery mobile. have pop-up box opened jquery function (a function triggered user click of item on page sitting inside of iframe in view). once pop-up appears, user able click “yes” or “no” (as confirmation) . if user clicks “yes”, triggering action in controller in order database work. once work of action completed, return same view started, new information in model want displayed. of works.

the pop triggered correctly, action appropriately triggered when “yes” clicked, , can step through action , see database work completing correctly , reloading model new information. can step through , see it’s calling correct view upon return view, , new model information reaching html helpers.

however, page in safari never refreshes. it’s still same before went action. i’ve tried returning view entirely see if cause refresh, old page stays there stubbornly.

here's relevant code view (wotest):

@section header  {    <script type="text/javascript">         $(document).ready(function () {             $('#popupsubmit').bind('click', function () {                  $.post('@url.action("loadtestdata", "wo")',                   {compkey:lblcompkey.innerhtml, servicerequestnumber:lblservicerequestnum.innerhtml});                 });                                       });            function newworkorder(compkey, comptype, unitid) {                         $('#popupdialog').popup('open');                         $('#lblcompkey').html(compkey);                         $('#lblcomptype').html("comptype: " + comptype);                         $('#lblunitid').html("unit id: " + unitid);        }       </script>      }  @section content  {      <div data-role="content" data-theme="c">         @using (html.beginform("createsrtemp", "wo", formmethod.post))         {                         <div class="ui-grid-c" style="margin-bottom:6px;">                   <div class="ui-block-a" style="width:32%; padding-right:2%;">                       <label id="lbladdress" style="font-weight:bold; color:#28608e;">asset address:<br /></label>                      @html.textbox("assetaddress", model.assetaddress, new dictionary<string, object>() {                      { "readonly", "true" }, { "data-mini", "true" } })                   </div>                  <div class="ui-block-b" style="width:22%; padding-right:2%;">                      <label id="lblasset" style="font-weight:bold; color:#28608e;">asset:<br /></label>                     @html.textbox("asset", model.asset, new dictionary<string, object>() {                      { "readonly", "true" }, { "data-mini", "true" } })                  </div>                  <div class="ui-block-c" style="width:15%; padding-right:2%;">                       <label id="lblassetid" style="font-weight:bold; color:#28608e;">asset id:<br /></label>                     @html.textbox("assetid", model.assetid, new dictionary<string, object>() {                      { "readonly", "true" }, { "data-mini", "true" } })                    </div>                  <div class="ui-block-d" style="width:31%;">                       <label id="lbllogcomment" style="font-weight:bold; color:#28608e;">log comment:<br /></label>                     @html.textarea("logcomment", new dictionary<string, object>() { { "data-mini", "true" } })                    </div>              </div>               <div class="ui-grid-c">                  <div class="ui-block-a" style="width:25%; margin-top:8px;">                     <label id="lblassignedto" style="font-weight:bold; color:#28608e;">assigned to:<br /></label>                      @html.dropdownlist("assignedto", model.listofactiveemps, "select employee", new { data_mini = "true" })                  </div>                  <div class="ui-block-b" style="width:20%; margin-left:5px; margin-top:8px;">                    <label id="lblpriority" style="font-weight:bold; color:#28608e;">priority:<br /></label>                     @html.dropdownlist("priority", model.listofpriorities, "select priority", new { data_mini = "true" })                  </div>                  <div class="ui-block-c" style="width:25%; margin-top:8px; margin-left:5px;">                    <label id="lblwotype" style="font-weight:bold; color:#28608e;">wo type:<br /></label>                     @html.dropdownlist("wotype", model.listofwotypes, "select wo type", new { data_mini = "true" })                  </div>                  <div id="divcreatebutton" class="ui-block-d" style="float:right; margin-top:27px;">                                       <input id="btncreatewo" data-mini="true" data-theme="b" type="submit" style="height:35px;" value="create wo" />                                </div>              </div>         }                <div data-role="popup" id="popupdialog" data-overlay-theme="a" data-theme="b" data-dismissible="false"             style="max-width:416px;" class="ui-corner-all">                  <div data-role="header" data-theme="a" class="ui-corner-top">                     <h1>asset selection <label id="lblservicerequestnum" style="text-align:left;  height:22px; font-size:14px;">@model.servicerequestnumber</label> </h1>                 </div>                  <div data-role="content" data-theme="a" class="ui-corner-bottom ui-content">                           <h3 class="ui-title" style="text-align:center; height:22px;">are sure?</h3>                                                  <label id="lblcompkeylabel" style="text-align:left;  height:22px; font-size:14px; margin-left:95px;">comp key: </label>                                       <label id="lblcompkey" style="text-align:left;  height:22px; font-size:14px;"></label>                       <label id="lblcomptype" style="text-align:left;  height:22px; font-size:14px; margin-left:95px;"></label>                                        <a id="popupsubmit" data-role="button" data-inline="true" data-rel="back"                     data-mini="true" data-theme="b" style="width:150px;" type="submit">yes</a>                     <a href="#" data-role="button" data-inline="true" data-rel="back"                          data-mini="true" data-transition="flow" data-theme="b" style="width:150px;">no</a>                  </div>           </div>               </div>       <h5>@viewbag.message</h5>                   <div class="ui-grid-solo">          <div id="mapdiv" class="ui-block-a" style="margin-top:8px; width:100%;">               @{                   string xpoint = "?xpoint=" + @model.xcoordinate;                 string ypoint = "&ypoint=" + @model.ycoordinate;                 string _uri = "/test/map.htm" + xpoint + ypoint;                 if (request.islocal)                     _uri = "../../map.htm" + xpoint + ypoint;                  <iframe id="mapiframe" width="100%" src="@_uri"></iframe>              }           </div>      </div> 

the pop-up calls action, in wocontroller:

    [httppost]     public actionresult loadtestdata(string compkey, string servicerequestnumber)     {        //do database stuff, load model properties new info        return view("wotest", srmodel);        } 

this action should return same view (wotest) new info in model. i've step through action code, works expected. srmodel sent wotest @ end has correct new information...anyone have ideas why isn't displayed in wotest? it's if wotest doesn't refresh @ all.

i've tried using modelstate.clear, didn't help.

any appreciated. thank you!

if finds this, ended solving own issue separating part of view needed update partial view. put placeholder div (#detailsdiv) in main view (wotest). changed action (loadtestdata) returning partial view instead of returning main view. so, altered jquery partial view loaded model data on click of pop-up's submit button so:

    $(function () {         $("#popupsubmit").bind("tap", thandler);          function thandler(event) {             $.post('@url.action("loadtestdata", "wo")', { compkey: lblcompkey.innerhtml, servicerequestnumber: lblservicerequestnum.innerhtml },              function (data) { $('#detailsdiv').html(data); $('#detailsdiv').trigger("create"); });         }     }); 

unfortunately, solves issue in desktop safari...i'll have find solution ipad.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -