0

My site developed in Codeigniter, using JQuery post method to retrieve the data, it is showing 404 not found error while I see in firebug it is showing the correct output.

It is working fine in local system. My site is under sub domain on live instance which may cause the issue?.

Please hint what could be the issue.

Here is my htaccess file

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule> 

Here is the firebug response details

Connection  Keep-Alive
Content-Type    text/html
Date    Mon, 23 Jul 2012 12:28:26 GMT
Keep-Alive  timeout=3, max=29
Server  Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 mod_fcgid/2.3.6
Transfer-Encoding   chunked
X-Powered-By    PHP/5.2.17
Request Headers
Accept  text/html, */*; q=0.01
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection  keep-alive

Here is my code

function updatepanel()
{
$.post("http://svims.noq.co.in/svims/get_token/28" ,
function (d)
{
    $("#tokenview").html(d);
}
);
}

Here is the firebug response.

"NetworkError: 404 Not Found - http://svims.noq.co.in/svims/token_generator"

token_generator POST http://svims.noq.co.in/svims/get_token/28

404 Not Found 2.36s

======================================== Issue was, sub domain name and controller name should not be same. I renamed the controller name and it works fine.

AjayR
  • 4,169
  • 4
  • 44
  • 78
  • 3
    Any chance we could see the jQuery code? – Anthony Grist Jul 23 '12 at 12:24
  • I'm sure you've already checked, but can you confirm whether or not the HTTP Response Code is 404 in the response headers? I use header codes a lot and specify body content as well. – Roger Thomas Jul 23 '12 at 12:23
  • Issue is solved, actually the problem is the sub domain names (svims) and controller name was same so this issue raises. It is strange that it worked earlier. Now I renamed the controller name to other and its working fine. – AjayR Jul 24 '12 at 00:17

3 Answers3

0

two things to check...

Number 1

Don't use full URLs for ajax requests unless its absolutely required..

$.post("http://svims.noq.co.in/svims/get_token/28" ,
//Should Become:
$.post("/svims/get_token/28" ,

Number 2

Make sure you aren't echoing back anything or dumping any errors or notices onto your page as it will throw the request off.. Press F12(Cmd+J) in chrome to open developer toolkit, then goto network tab, click xhr on the bottom and then submit your ajax again and watch for the POST to return, click preview and see what it returns.. See this question on SO..

Request Monitoring in Chrome

Community
  • 1
  • 1
NDBoost
  • 10,184
  • 6
  • 53
  • 73
0

Issue was, sub domain name and controller name should not be same. Renaming the controller name and it works fine.

AjayR
  • 4,169
  • 4
  • 44
  • 78
0

Just another note: Some web hostings installs by default subdirectories/subdomains like /stats, /logs and if your webhosting has them you may get 404 error with CI

I created an app in a subdomain and named one controller as 'stats' and was getting 404 error header even if the final content was correct. After changed the controller name the error was gone.

Joao
  • 1