view not refreshing after zend redirect -
so trying do, after user submit information, make call action call saveronda, save information on database, after saving want redirect page, according firebug html correct, view isnt refreshing. here code in /rondas/chooseronda ive got this
<span class="st-labeltext">tags da ronda:</span> <table id="toolbar2"></table> <div id="ptoolbar2"></div> <div class="clear" style="z-index: 670;"></div> </div> <div class="st-form-line" style="z-index: 680;"> <span class="st-labeltext">nome da ronda:</span> <input type="text" name="nomeronda" id="nomeronda"> <div class="clear" style="z-index: 670;"></div> </div> <div class="st-form-line" style="z-index: 680;"> <span class="st-labeltext">tag inicial:</span> <select id="tagini" name="tagini"> </select> <div class="clear" style="z-index: 670;"></div> </div> <div class="st-form-line" style="z-index: 680;"> <span class="st-labeltext">tag final:</span> <select id="tagfim" name="tagfim"> </select> <div class="clear" style="z-index: 670;"></div> </div> <div class="st-form-line" style="z-index: 680;"> <span class="st-labeltext">ordem:</span> <select id="ordem" name="ordem"> <option value="sim">sim</option> <option value="não">não</option> </select> <div class="clear" style="z-index: 670;"></div> </div> <div class="button-box" style="z-index: 460;"> <input id="button" class="st-button" type="submit" value="submit" name="button"> <input id="button2" class="st-clear" type="reset" value="cancel" name="button"> </div>
when user press button submit making ajax call /rondas/saveronda , send data, here code:
<script language = "javascript"> $(document).ready(function() { $("#button").click(function () { /* $.ajax({ url: '/rondas/saveronda', type: 'post', data: {param1: param1, param2:param2 }, datatype: "json" */ //buscar o nome /*var nomeronda=$("#nomeronda").val(); //buscar ordem var ordem=$("#ordem").val(); //tag inicial e tag final var taginicial=$("#tagini").val(); var tagfinal=$("#tagfim").val(); if(taginicial==tagfinal) { alert("a tag inicial não pode ser mesma que tag final"); } else { var tags=""; //var allrowsoncurrentpage = $('#toolbar2').getdataids(); var ids = $("#toolbar2").jqgrid('getdataids'); (var = 0; < ids.length; i++) { var rowid = ids[i]; var rowdata = $('#toolbar2').jqgrid ('getrowdata', rowid); tags=tags+rowdata.id_tag.tostring()+' '; }*/ $.ajax({ url: '/rondas/saveronda', type: 'post', data: {param1: "sasa"}, datatype: "json" }); //} }); }); </script>
in case sending param1 value "sasa", , through firebug detecting post /rondas/saveronda. after saving data want redirect user /rondas/list, have been trying different solution
public function saverondaaction() { // action body /* if($this->_request->isxmlhttprequest()) { $param1 = $this->_request->getparam('param1'); $param2 = $this->_request->getparam('param2'); $param3 = $this->_request->getparam('param3'); $param4 = $this->_request->getparam('param4'); $param5 = $this->_request->getparam('param5'); $rondasmodel= new application_model_ronda(); $this->_forward('list', 'rondas'); } * */ $this->_helper->redirector->gotoroute( array( 'controller' => 'rondas', 'action' => 'list' ) ); }
or using redirect or forward.. none have worked, view still /rondas/choosetags , not /rondas/list
what error... in advance..
your initial view /rondas/chooseronda
when user press submit make ajax call /rondas/saveronda
, send data it. if successful want redirect initial page (/rondas/chooseronda
) /rondas/list
.
if redirect code written in action /rondas/saveronda
not working, return success message initial view (/rondas/chooseronda
), there you'll need detect success message in jquery ajax code. if successful, put redirect jquery code, redirect /rondas/list
.
Comments
Post a Comment