Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:21:06+00:00 2026-06-17T05:21:06+00:00

EDITS: I have eliminated the variable var path that I had to indicated the

  • 0

EDITS: I have eliminated the variable var path that I had to indicated the URL to the controller and used the url itself, now the path error is gone but I get no data. Something in the communication of the files is not being passed on.

What I am trying to do is upon scrolling, have the page load data from the server. For that purpose I am using a separate jquery file, a view, the controller and the model.

JQUERY FILE. You will see it is pretty straightforward:

    $(document).ready(function() {

    var pageLoaded = 1; //this basically says that we are on page 1 of the results

      $(window).scroll(function()
       {

        if($(window).scrollTop() == $(document).height() - $(window).height())
        {
         pageLoaded = pageLoaded+1; //when this condition has met, increase the pageLoaded so that I can tell php to load in data for page 2/3/4/5, etc, etc

/*// below I send the data to the controller named Home its function loadData gets a variable named id_load with value = to pageLoaded*/

         $.get('home/loadData', {'id_load':pageLoaded}, 
            function(data)
            {
                if (data != "")
                {
                 $('#submissions').append(data);
                }
             }
         );
         //alert(pageLoaded);
        }
       }
      );


    });

CONTROLLER:

<?php if (! defined('BASEPATH')) exit ('No direct script access allowed');


class Home extends CI_Controller 
{
    function __construct()
    {

        parent::__construct();

        $this->load->model('load_model');
        $this->output->enable_profiler(TRUE);

    }


    public function loadData ()
    {
        $pageNumber = $this->input->get('id_load'); 
        $this->load_model->loadPage($pageNumber);

    }


    public function index()  
    {
      $data = array('title' =>'homepage', 'main_content' =>'home_v');
      $this->load->view('template', $data); 

    }



} 

and the MODEL should display the content as it gets new values while u scroll:

<?php


class Load_model extends CI_Model {



    public function loadPage ($pagenumber )

    {

        $sql = $this->db->where('id_load', $pagenumber)->get('data');

        $cadena = "";

        foreach($sql->result_array() as $reg)
        {
        $cadena =   $reg['content'];    

        }

        echo $cadena;


    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:21:07+00:00Added an answer on June 17, 2026 at 5:21 am

    try this..

    in your header <head> put a javascript varaiable with base_url() at the top..

    here

    html

    <head>
      <script>
         var base_url=<?php echo base_url()?>;
      </script>
     ....
    </head>
    

    jquery

    var path = base_url + 'index.php';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that edits an instance of my model. I would like
I have two pages, one that edits user information, and one that edits information
I'm trying to put together a form_tag that edits several Shift objects. I have
I have edits to my working tree which I would like to continue working
EDIT: I have fixed all but two warnings now, so thank you all for
I have a do/while loop that goes over database rows. Because it runs many
I have 2 plain text files that contain some words, like: File 1 Aarhus
I have a very complicated mathematica expression that I'd like to simplify by using
Ok hope that title wasn't misleading I have (among other columns) the following info
I have a C++ class that writes its data out to a binary std::ofstream

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.