Welcome Guest, Not a member yet? Register   Sign In
CJAX and CodeIgniter implementation problem
#1

[eluser]gwatt[/eluser]
Basically I am having a problem getting CJAX to work in Code Igniter.
I have downloaded and installed the specific Code Igniter version here:
http://sourceforge.net/projects/cjax/files/

The documentation on the Code Igniter implementation seems hard to find.

I have been told to only use the ajax.php and response directory for ajax calls from inside normal code igniter URLs, for example: http://uebusaito.com/engproj/index.php/vocab/study

However in order to test the installation with the included examples you go through the ajax.php file itself. http://yoursite.com/ajax.php?controller=...ction=test

So there is no test example using a code igniter generated page with a code igniter url.

When I coded everything to run through the ajax.php file rather than load the view from the code igniter index.php file I got it to work (mostly, otherwise I wouldn't be trying to do it another way)

---

Now I have coded a code igniter url to generate a page with calls to ajax.php but the AJAX calls don't update the page and when I look at the debugging information in google chrome the ajax calls have a strange "crossdomain" part.

Here is the strange URL:
http://uebusaito.com/engproj/ajax.php?_c...153792877/

If I visit this above ajax URL directly I get a strange sourceforge website ?!?!?!
I have no idea where that is coming from.

I am using an ajax call like this:
$callTemp = base_url() . "ajax.php?ajax_vocab/answer_question/" . $value['word_id'] . "/" . $currentWordArray['word_id'] . "/" . $answerCount;

I am not getting any server errors.

I'm not sure if the "crossdomain" I'm getting in the URL is normal. I have attached a screen shot.

In case anyone wants to see for themself the URL is
http://uebusaito.com/engproj/index.php/vocab/study

the user / password is test / test

I would appreciate any help!
#2

[eluser]LuckyFella73[/eluser]
Don't know if that helps - I get this error in my console:

Refused to set unsafe header "Content-length"
#3

[eluser]gwatt[/eluser]
Hi,

Yes I saw that too but I did some searching and it might a non-critical error.

For example it doesn't show up in firefox but it still doesn't work.

Although it could be a problem.

I'm really interested in why I get a source forge looking website when I go to the "crossdomain" link.
#4

[eluser]gwatt[/eluser]
I managed to solve my problem finally. The above link no longer works but I have setup a new test version so people can look at that online.

Here is a copy of my post in the code igniter thread

------------------------

I managed to solve a frustrating problem I was having with CJAX and Code Igniter.

I thought this might help someone.

If I use the full location to ajax like this
$ajax->click(’#click_div’,$ajax->call(‘http://uebusaito.com/test_ci_cjax3/ajax.php?click/update/’));

then the link turns into a crossdomain link (and nothing happens)
http://uebusaito.com/test_ci_cjax3/ajax....644449730/


For some reason even though it resolves to the same location I have to use relative links - like this:
$ajax->click(’#click_div’,$ajax->call(’../../ajax.php?click/update/’));

I feel like relative links could be a problem later because it relies on the Code Igniter URL always having a controller and a function - which may not always be the case.

So I would like to get absolute links working.

If anyone has any advise please let me know.

G




Theme © iAndrew 2016 - Forum software by © MyBB