Welcome Guest, Not a member yet? Register   Sign In
CJAX--New User Issue
#1

[eluser]bhogsett[/eluser]
I started using Codeigniter a week ago. I am developing in MAMP and have a MVC application that pulls data from a MYSQL database and displays. Nothing fancy.

So, I want to use AJAX to pull the data rather than reloading the page.

I have installed and have CJAX up and running--sort of! I can run the test.php and the examples with no problem.

So I decided to take the click_ajax_request.php from the CJAX examples and drop it into my application and go from there. But it fails.

When I click on the button generated by the ajax_request code that is now in my application in the view file, I get this error:

http://localhost:8888/cicjax/ajax.php?cl...tton/Hello World 404 Not Found

I have tried both the .min and regular js file (love the name!) and get this line number error in FireBug when running the regular version:

http://localhost:8888/cicjax/cjax/core/j...ama2012.js

I am pretty sure this is a beginners configuration error, but I have beat my head against the wall long enough!

Any suggestions will be appreciated and tried.

Bill
#2

[eluser]bhogsett[/eluser]
No replies after 3 days. Is this the wrong place to ask the question? Maybe it is much more a cJAX question than CodeIgniter.

Bill
#3

[eluser]Ajaxboy[/eluser]
I think you are accessing the controller in a wrong way, if you just follow the example as it is, (including the url style, notice it doesn't say "Hello" at the end of the sample demo url , that is instead part of the ajax controller), if you follow the example correctly you should be able to get it working.

As it appears you are trying to access the ajax controller directly, and instead you should display the normal ci controller method and from there load cjax, just as the examples directory acts as if it was the the ci controllers.

A quick way to get it working is...

1. just create a new method in your ci controller and call it ajax_click(),

2. then do the normal steps to include cjax ( require_once 'ajax.php'Wink..etc..

3. then create your view and paste the code from sample in the samples directory inside your view.

4. Add the ajax controller in the response directory that handles that operation.

and ready..

In other words just try to mimic what is already there, the "examples" directory itself acts as if it was your controller/view in a none MVC way. You grab what's there and add to your controller and view and get it working by mapping it to your MVC paths.

The reason is done that way is because it is the simplest way to display the samples without getting complicated.

Also, just to be sure, you always want to have the latest version.. so I recommend you download the latest 5.4 version as it guarantees the latest updates and stability, although there is nothing wrong with the older versions.
#4

[eluser]bhogsett[/eluser]
Thanks, I will check it out, but I am watching golf today.
#5

[eluser]bhogsett[/eluser]
I solved my issue.

I had read the post on creating an MVC using CJAX and reread it after the message above. I had not followed the procedure outlined in the post and when I did everything worked. Mark it up to a new user error!!

Thanks.

Bill




Theme © iAndrew 2016 - Forum software by © MyBB