Welcome Guest, Not a member yet? Register   Sign In
ajax requests with jquery -- help
#1

[eluser]bryantAXS[/eluser]
So I'm having some trouble with getting some ajax calls to work using jQuery.

I had it working fine previously, but then I made some modifications to my .htacess file and a few more changes and now it seems to not be working. I think it has somthing to do with my .htaccess file - config.php and maybe routing.php?

It would be great if someone could explain how ajax calls work with codeigniter and how they are routed to the controller.

When my ajax call is fired in the page it looks to this url:

http://localhost:888/realm/index.php/sit.../twitterTL

It should be connecting to:

http://localhost:888/realm/index.php/ajax/twitterTL

actual ajax call

Code:
$.ajax({
  type: "GET",
  url: "ajax/twitterTL",
  data: "",
  dataType: 'json',
  success: function(data){
  self.addNewTweets(data);
  }
});

Any help and explanation would be greatly appreciated!

.htaccess

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /shop/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

config.php
Code:
$config['base_url'] = "http://localhost:8888/realm/";
$config['index_page'] = "";
$config['uri_protocol']    = "AUTO";

routes.php
Code:
$route['default_controller'] = "site";
$route['scaffolding_trigger'] = "";


Messages In This Thread
ajax requests with jquery -- help - by El Forum - 08-26-2009, 11:23 PM
ajax requests with jquery -- help - by El Forum - 08-26-2009, 11:47 PM
ajax requests with jquery -- help - by El Forum - 08-27-2009, 12:04 AM
ajax requests with jquery -- help - by El Forum - 08-27-2009, 01:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB