Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with CI Session library #40

Open
templeman opened this issue Feb 22, 2017 · 6 comments
Open

Conflict with CI Session library #40

templeman opened this issue Feb 22, 2017 · 6 comments

Comments

@templeman
Copy link

I am integrating CJAX-5.9-RC8 with my app running on CI-3.1.3. I've found that CJAX is working great, except when I load Codeigniter's Session library. With this library loaded, CJAX doesn't seem to work at all - no responses, no errors, nothing.

The CI Session library has changed substantially since 3.0, and the docs even mention the potential affects on AJAX requests.

I'm wondering if there are any known issues with CJAX-5.9 conflicting with the new Session library, and what I might do to get them to play nicely together.

@ajaxboy
Copy link
Owner

ajaxboy commented Feb 24, 2017

Hello @templeman - thanks so much for your question and I was not aware this was an issue however -

I am interested to into to reproduce it, can you please state the steps that you take - such as a usage case, and how you reproduce it?

and to summarize it, are you saying the issue is that the requests are slower?

@templeman
Copy link
Author

I start out with a fresh install of Codeigniter v3.1.3. Then I add a fresh download of CJAX-5.9-RC8 as per the documentation. When I run the initial test at http://somesite.com/ajax.php?test/test, everything works.

Next I set up a simple test controller:

<?php

    class Test_cjax extends CI_Controller {

      public function index()
      {
        require_once "ajax.php";
        $ajax = ajax();
        $ajax->click("button1", $ajax->call("ajax.php?click_response/click_button/Hello!"));
        $this->load->view('cjax_test');
      }

    }

With the response controller:

<?php

class click_response {

  function click_button($message)
  {
    $ajax = ajax();
    $ajax->success("You clicked the button.. $message");
  }
}

And a basic view:

<!doctype html>
<head>
    <script id='cjax_lib' type='text/javascript' src='cjax/core/js/cjax.js'></script>
    <title>Simple ajax request binded to a button</title>
</head>
<body>
    <input type='button' id='button1' value='Click this button to make an ajax request'>
    <div id='response'></div>
</body>
</html>

And all of this works. If I go to http://somesite.com/Test_cjax, I get the button and clicking it returns a successful AJAX response.

The problem shows up when I start loading Codeigniter's Session library. For example, using this same setup, I can go to autoload.php and set $autoload['libraries'] = array('session'); (and set my encryption key). Now when I go to http://somesite.com/Test_cjax and try the button, nothing happens. Clicking it gives no AJAX response, and no error messages or console messages.

So in short, it seems like CI's Session library is somehow interfering with CJAX and preventing the AJAX calls from working at all.

@templeman
Copy link
Author

@ajaxboy are you able to replicate the issue I'm having? I'm very interested to know whether this is a CJAX bug or if it's related to my own setup somehow.

@templeman templeman changed the title Conflict with Session library Conflict with CI Session library Apr 5, 2017
@dlzi
Copy link

dlzi commented Jun 21, 2017

@ajaxboy was this fixed?

@ajaxboy
Copy link
Owner

ajaxboy commented Jul 8, 2017

@danielzilli the issue is being looked into.

@webdevelement
Copy link

is the 5.9-RC10 have fixed this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants