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 991817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:10:08+00:00 2026-05-16T06:10:08+00:00

Last time I did PHP I worked with CodeIgniter. To implement AJAX I used

  • 0

Last time I did PHP I worked with CodeIgniter. To implement AJAX I used the XAJAX library, which was extremely simple and was capable of invoking private controller methods. Unfortunately XAJAX does not seem to be compatible with the latest version of CodeIgniter, or it might just be that it is not compatible with php5.2/5.3.

I was thinking of using jQuery, but since jQuery sends requests to an accessible URL it isn’t able to invoke private methods. One of the reasons I want to use private controller methods for some of the ajax functionality is because I do not want the functionality to be directly accessible via an URL.

So, is there an ajax library for CodeIgniter that can invoke private controller methods?

EDIT: treeface’s answer has helped me out by pointing out that jQuery has a .post() method. However, I am still looking for a library for CodeIgniter that plugs AJAX functionality in the framework. I would prefer to work with AJAX via PHP and CodeIgniter itself rather than typing out jQuery in my templates. Is there such a library around still?

  • 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-16T06:10:09+00:00Added an answer on May 16, 2026 at 6:10 am

    Hm this is kind of an odd question to approach. If you want to call something on your server from Javascript, you can do it in one of two ways (ignoring web sockets for the moment):

    1. A GET request where only a URL string and headers are sent to the server. With this method, you put your request information in the URL.
    2. A POST request where a message of arbitrary length is also sent along with your URL and headers. In this method you could place variables in your URL, but it would be wiser to place them in your message body.

    It’s important to note that jQuery has a GET method and a POST method, so your comment about how jQuery “sends requests to an accessible URL” is true, but incomplete. It also supports post requests.

    With either method, it is impossible to hide something from a dedicated malcontent regarding which controller methods you’re invoking, or how you invoke them. If you send your information via GET or POST, they can easily simulate that function in their browser and send a request to your controller that perfectly replicates that which is in your code. For anything that is public-facing, you will want more comprehensive security measures (where needed) than simply restricting direct URL access to controller functions.

    So back to your question…”not making it accessible via a URL”…it seems kind of an odd problem to solve since if you make it inaccessible via a URL, you could just as easily access it via a POST request. But ignoring this for a moment, the way I’d do it is this…

    1. Create a public controller method that handles an incoming POST request (or group of POST requests). Inside this method search for a specific variable which will tell your controller which private methods to invoke.

    2. In Javascript, include a variable in your POST message that can be set to whatever value you like. You can think of this as your method trigger that will be read by your controller to decide which private method to invoke as described above.

    Any CI AJAX library that you can find that “accesses private methods” is assuredly doing some derivation of this. Remember: anything you do in your javascript can be seen by others, and therefore can be replicated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's been a while since I used GTK+, and the last time I did
The last time I did any serious Java coding was back around the turn
How can I display the last time the current document was updated in PHP?
I am needing to download a very large file via PHP, the last time
I have this login code, which works last night before I slept. Nobody used
I am sorry the last time I had used this website was my first
Hello i'm having trouble with making like a simple waiting time between 2 php
I had much luck last time I submitted a question so here goes: I
it’s been a while since the last time I had to use regex, I
How do you find out the last time a MySQL database was read or

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.