Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating a loadmore button and display next set of content in same codeigniter view
    text
    copied!<p>I am trying to create a loadmore button. If clicked it must load next records appended to previous one. Here is my controller class</p> <pre><code>class Sample extends CI_Controller{ function wall($start) { $start = $this-&gt;input-&gt;post('start'); $resultjson = $this-&gt;curl-&gt;simple_get("http://www.mywebsite.com/api/posts.php?start=$start&amp;count=10"); $resultant_data = json_decode($resultjson,true); $data['sample'] = $resultant_data; $this-&gt;load-&gt;view('posts',$data); } } </code></pre> <p>In My view</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;I have some js files such as masonry&gt; &lt;script type="text/javascript"&gt; function loadmore() { $.ajax({ type:"POST", url:"http://www.server.com/application/index.php/Sample/wall/", data :"start=10", //dataType : 'json', success: function (data) { alert(data); } }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; . . . . . . . . . . &lt;div id="loadmore" style="margin-top:75%;"&gt; &lt;input type="button" value="loadmore" onclick="loadmore()"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Sample is class name and wall is method name The problem is if i directly call <strong>www.mysite.com/application/sample/wall/10</strong> in the url it gives me <strong>next 10 records</strong>.... But i am unable to display next ten records if clicked on the <strong>loadmore</strong> button. i.e if i call <strong>www.mysite.com/application/sample/wall</strong> i will be getting 0 to 10 and a loadmore button. When button is clicked it must display <strong>next ten as well as the earlier data.</strong> Can anyone please help me </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload