Welcome Guest, Not a member yet? Register   Sign In
method without parameters in ajax call

I had a method in my controller that return an html form so..I made the next code to display it.

return false;

The problem is...when I check it with firebug, the result is a 404 error page because load() makes a GET call by default, I tried setting the second param to NULL in load function but didn't work.

Someone help me !!!

Are you sure that the url you are requesting is right. Try using the full url path.

yes, when I put 'controller/method' in my browser I can see the form that I want to load with ajax.

I thought that the problem was the '?...12345' param that jquery adds for non cache so I prove setting to NULL the second param in load() but didn't work...then I thought: 'a77icu5...you must ask in the codeigniter forum'.

Please post a screenshot of the Firebug log and the code of the controller.

[eluser]Johan André[/eluser]
My guess is one of the following:

* You got CI installed in folder under the webroot (http://www.example.com/my_site/).

* You are not using a .htaccess or it is not configured ok.

I suppose your controller and method is not named controller and method?

//this is my tree folder

//my controller
class Drivers extends Controller
    public function __construct() {
    public function index() {
    public function driverform() {

//my jquery code
$(function() {
    var ajaxLoad = "<img src='images/loading.gif' alt='loading...' />";
        return false;

//my .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Url 'site/drivers/driverform' it's working...but ajax call '/drivers/driverform'...no.

I found the problem !!!

IE by default enable ajax cache, most of developers recomended set the ajax cache in jquery to false, then jquery generate a big integer for no cache, that's the reason of the strange URL. I commented this line $.ajaxSetup ({ cache: false }); and it works !

The question is...my aplication will be stable usign IE ?

I use jQuery and CI on commercial high (ish) traffic sites and the ajax load command all the time and have never had an issue with the cache (well I have but not a 404 and instead passed in new Date.time with the url to ensure a fresh page each time).

So how can this be the issue, and you mention IE here but the screenshot is from firebug on firefox?

As long as it works for you that is all that counts. Secondly are you calling an area of the page you are loading or the full page with the header file in and injecting into your body?

If so that will crash IE. You need to target a section for example .load('/the/page/url/ #contentidorclass', '', function(){ callback if required.});

Yes the screenshot is from firebug on firefox, I set the jquery ajax to false just in case the app has been running on IE, when I'm coding without CI [just PHP] I haven't this problem, that's the reason of I didn't knew what to do, I'll be testing on IE to check if crash. I'm calling a full view with that method and I injected on body just to test. I'll be grateful if someone found the solution to work with CI + no cache with jquery xD.

Theme © iAndrew 2016 - Forum software by © MyBB