<small id='CqOqz'></small><noframes id='CqOqz'>

      <bdo id='CqOqz'></bdo><ul id='CqOqz'></ul>
  • <legend id='CqOqz'><style id='CqOqz'><dir id='CqOqz'><q id='CqOqz'></q></dir></style></legend>

        <tfoot id='CqOqz'></tfoot>
        <i id='CqOqz'><tr id='CqOqz'><dt id='CqOqz'><q id='CqOqz'><span id='CqOqz'><b id='CqOqz'><form id='CqOqz'><ins id='CqOqz'></ins><ul id='CqOqz'></ul><sub id='CqOqz'></sub></form><legend id='CqOqz'></legend><bdo id='CqOqz'><pre id='CqOqz'><center id='CqOqz'></center></pre></bdo></b><th id='CqOqz'></th></span></q></dt></tr></i><div id='CqOqz'><tfoot id='CqOqz'></tfoot><dl id='CqOqz'><fieldset id='CqOqz'></fieldset></dl></div>

        在 ajax 调用后加载视图,CodeIgniter

        时间:2023-10-12
          <tbody id='PSp5z'></tbody>

              • <i id='PSp5z'><tr id='PSp5z'><dt id='PSp5z'><q id='PSp5z'><span id='PSp5z'><b id='PSp5z'><form id='PSp5z'><ins id='PSp5z'></ins><ul id='PSp5z'></ul><sub id='PSp5z'></sub></form><legend id='PSp5z'></legend><bdo id='PSp5z'><pre id='PSp5z'><center id='PSp5z'></center></pre></bdo></b><th id='PSp5z'></th></span></q></dt></tr></i><div id='PSp5z'><tfoot id='PSp5z'></tfoot><dl id='PSp5z'><fieldset id='PSp5z'></fieldset></dl></div>

                <small id='PSp5z'></small><noframes id='PSp5z'>

              • <tfoot id='PSp5z'></tfoot>
                  <bdo id='PSp5z'></bdo><ul id='PSp5z'></ul>
                  <legend id='PSp5z'><style id='PSp5z'><dir id='PSp5z'><q id='PSp5z'></q></dir></style></legend>

                • 本文介绍了在 ajax 调用后加载视图,CodeIgniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个从 javascript 到控制器中的方法的 ajax 调用,控制器中的方法应该加载一个视图(比如,在屏幕上显示一个新页面),虽然一切看起来都很好,但新视图没有似乎加载在屏幕上.我不能使用 header 或 windows.location 因为,我正在传递一个数组变量,其中包含要在视图中使用的数据.

                  I have an ajax call from javascript to a method in a controller, the method in the controller should be loading a view(like, show a new page on the screen), Although everything seems ok, the new view doesn't seem to load on the screen. I cannot use header or windows.location because, i am passing an array variable, containing data to be used in the view.

                  该页面在 Chrome 调试控制台的网络选项卡(预览子选项卡,同时选择 ajax)下可见.但主屏幕保持原样.

                  The page is visible under the Network tab (preview sub tab, while selecting the ajax) of the Chrome debugging console. But the main screen stays as it is.

                  如果有人遇到过类似的问题,或者有解决方案,请帮助我.

                  If somebody has faced a similar issue, or has a solution, please help me.

                  谢谢!!

                  推荐答案

                  好的,这就是你做错的地方.

                  Ok here is what you are doing wrong.

                  当您使用 ajax 请求页面时,它不会返回该页面.

                  when you request the page using ajax it does not return you that page.

                  当你使用 $this->load->view('pagename',$datapassed);它加载了视图,这就是为什么你什么也看不到的原因.

                  When you use $this->load->view('pagename',$datapassed); it loads the view and that's why you see nothing.

                  你要做的就是使用

                  $data=$this->load->view('pagename',$datapassed, TRUE);
                  

                  它会做的是,它会返回那个页面并将其保存在 $data 中之后,您可以使用

                  What it will do is, it will return that page and save it in $data after that you can print it using

                  $this->set_output($data); 
                  

                  并在ajax结果中接收它并将其加载到div中.

                  and receive this in ajax result and load it in a div.

                  如果你想刷新整个页面,你可以使用

                  and if you want to refresh the whole page you can use

                  $(body).html(result);
                  

                  您必须了解您需要通过在加载视图中提供第三个参数来发送 html 页面.

                  You have to understand that you need to send the html page by supplying that third parameter in load view.

                  这篇关于在 ajax 调用后加载视图,CodeIgniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Codeigniter 扩展控制器,未找到控制器 下一篇:检查是否在“开发"中带 Symfony 的控制器内的模式

                  相关文章

                    <tfoot id='BXpip'></tfoot>

                    • <bdo id='BXpip'></bdo><ul id='BXpip'></ul>
                    <legend id='BXpip'><style id='BXpip'><dir id='BXpip'><q id='BXpip'></q></dir></style></legend>

                    1. <small id='BXpip'></small><noframes id='BXpip'>

                    2. <i id='BXpip'><tr id='BXpip'><dt id='BXpip'><q id='BXpip'><span id='BXpip'><b id='BXpip'><form id='BXpip'><ins id='BXpip'></ins><ul id='BXpip'></ul><sub id='BXpip'></sub></form><legend id='BXpip'></legend><bdo id='BXpip'><pre id='BXpip'><center id='BXpip'></center></pre></bdo></b><th id='BXpip'></th></span></q></dt></tr></i><div id='BXpip'><tfoot id='BXpip'></tfoot><dl id='BXpip'><fieldset id='BXpip'></fieldset></dl></div>