jquery - Render layout through ajax -
I'm calling a view called "thisweek" through a controller called "thisweek" to see an array And will return an object. Now I want to change it through Ajax. So I called an Ajax which again the controller calls "this" and calls to pass the data. But this layout fails to render. Controller is: -
public function action_thisWeek () {$ keyword = input :: post ("keyword"); $ User = (Input :: Post ("Users") == "")? -2: Input :: post ("user"); $ Direction = Input :: Post ("Direction"); If (isset ($ _ POST ['from_date']) & amp; amp; amp; amp; and isset ($ _ POST ['to_date'])): $ data ['from'] = $ _POST [ 'From_date']; $ Data ['from'] = $ _POST ['to_date']; Else: $ data echo ['from'] = (date ('n', time ()) == 1)? Date ('Y-M-D'): Date ('Y-M-D', Stromatem ("Last Monday")); $ Data ['from'] = date echo ('wi-m-d', strontem ("next Sunday"); if end; $ data ["date range"] = $ this- & gt; _createDateRangeArray ($ data [ 'From'], $ data ['from']); get (input :: get ("print") and input: get ("rollout") {$ data ['reservation'] = $ this - & gt; getReservations (array ("keyword" = & gt; $ keyword, "user" = $ user, "direction" = & gt; input :: find ("print"), "date" = & Input :: Mill ("roulette"));} other {$ data ['reservation'] = $ this-> getReservations (array ("keyword" => Keywords, "=> $ Data ['from']" from "user" = & gt; $ user, "direction" = & gt; $ direction, "from" = " );} If (Input :: get ("print") $ $ - return- gt; print ($ data); if (! Isset ($ _ POST ['from_date']) & amp; amp;! ; ($ _ POST ['to_date'])): $ this- & gt; template- & gt; title = "Reserveringen - deze week"; if end; $ this-> Template-> Content = view :: Forge ('admin / reservation / this option', $ data);} Ajax call is: -
$ Ajax ({type: "POST", url: "& lt ;? php goch Uri :: Base (false)? & Gt; index .php / admin / reservation / select", data: {to_date: week_to, from_date: Week_from}, success: function (reaction) {}}); Please help me how I can provide layouts through AJAX.
I have got the solution, I use reponse to send html, i mean i To pre> public function action_thisWeek () {$ keyword = input :: post ("keyword"); $ User = (Input :: Post ("Users") == "")? -2: Input :: post ("user"); $ Direction = Input :: Post ("Direction"); If (isset ($ _ POST ['from_date']) & amp; amp; amp; amp; and isset ($ _ POST ['to_date'])): $ data ['from'] = $ _POST [ 'From_date']; $ Data ['from'] = $ _POST ['to_date']; Else: $ data echo ['from'] = (date ('n', time ()) == 1)? Date ('Y-M-D'): Date ('Y-M-D', Stromatem ("Last Monday")); $ Data ['from'] = date echo ('wi-m-d', strontem ("next Sunday"); if end; $ data ["date range"] = $ this- & gt; _createDateRangeArray ($ data [ 'From'], $ data ['from']); get (input :: get ("print") and input: get ("rollout") {$ data ['reservation'] = $ this - & gt; getReservations (array ("keyword" = & gt; $ keyword, "user" = $ user, "direction" = & gt; input :: find ("print"), "date" = & Input :: Mill ("roulette"));} other {$ data ['reservation'] = $ this-> getReservations (array ("keyword" => Keywords, "=> $ Data ['from']" from "user" = & gt; $ user, "direction" = & gt; $ direction, "from" = " ); $ Weekend = Date ("W"); if (Input :: Receive ("Print") $ $ - Return- gt; _print ($ data); if (! Isset ($ _ POST ['from_date ']) & Amp; ;; isset ($ _ POST [' to_date '])): $ this- & gt; template- & gt; title = "Reserveringen -" $ week. "Week"; $ this- & gt; ; Template-> Content = View :: Forge ('admin / reservation / this option', $ data); Else: Return Feedback: Forge (see :: forge ('admin / reservation / this option', $ data)); end if; }
Comments
Post a Comment