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

  • Home
  • SEARCH
  • 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 485355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:23:35+00:00 2026-05-13T01:23:35+00:00

I have a method in codeigniter that looks like this, public function category() {

  • 0

I have a method in codeigniter that looks like this,

public function category() {
  //$this->output->enable_profiler(TRUE);
  //echo "Hello function called by ajax";
  $table = $this->uri->segment(3);
  $content_id = $this->uri->segment(4);
  $data['content'] = $this->site_model->get_content($table, $content_id);
  $this->load->view("call", $data);
}

This is method is called via ajax and the results are returned without the user ever leaving the page, this means that URI never gets passed so CI cannot get the segments however I do pull the url out with jquery is there way I can add my url variable that is created in javascript and somehowever get he values I need into PHP?

My javascript

$("a.navlink").click(function (ev) {
  $(this).toggleClass("active");
  ev.preventDefault();
  var id = $(this).attr("id")
  if ($(this).hasClass("active")) {
    $("."+id).remove();
  }
  else {    
    //  $(this).toggleClass("active");
    var url = $(this).attr("href");
    $.ajax ({
      url: "index.php/home/category",
      type: "GET",
      success : function (html) {
        //alert("Success");
        $("#accordion").append($("<div class="+ id +"/>").append(html));
      }
    });
  }
});
  • 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-05-13T01:23:36+00:00Added an answer on May 13, 2026 at 1:23 am

    You should add the id to the end of the url in your Javascript.

    like so:
    …

    $.ajax ({
          url: "index.php/home/category/" + id, 
          type: "GET",
    

    …

    I think you can also change your PHP to:

    <?php
           function category($content_id) {
              // $content_id = $this->uri->segment(4);
              $data['content'] = $this->site_model->get_content($table, $content_id);
              $this->load->view("call", $data);
            }
    
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use the following function like this: Image('/path/to/original.image', '1/1', '150*', './thumb.jpg');… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer Check you database schema to see if the field (referenced… May 13, 2026 at 2:13 am
  • Editorial Team
    Editorial Team added an answer I figured out the problem - there was a session… May 13, 2026 at 2:13 am

Related Questions

In codeigniter, as you know, a page of the form: /class/function/ID , where class
I'm currently having issues with my Facebook appliation being ported to CodeIgniter from raw
How can push a URI like this in CodeIgniter (1.7.1 currently): example.com/seg1/seg2/seg3/seg4/ or example.com/seg1/seg2/
I've been using the CodeIgniter framework, however after learning Java and awesome features like
I currently use CodeIgniter as my framework of choice when using PHP. One of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.