CodeIgniter Forums
ajax passing value in codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: ajax passing value in codeigniter (/showthread.php?tid=55115)



ajax passing value in codeigniter - El Forum - 10-10-2012

[eluser]stv[/eluser]
$.ajax({
type: "POST",
async:false,
url: "test/aj",
data: dataString,
success: function(text)
{
}
the echo item is not returning to function(text)


ajax passing value in codeigniter - El Forum - 10-10-2012

[eluser]CroNiX[/eluser]
use a full url, check in firebug/console to see that the ajax request is being sent to the correct url and also the post data.


ajax passing value in codeigniter - El Forum - 10-10-2012

[eluser]stv[/eluser]
i am new in codeigniter ,test is class and aj is function ,so i just pass the value to that functon and does not return any thing


ajax passing value in codeigniter - El Forum - 10-10-2012

[eluser]CroNiX[/eluser]
Which means nothing to your ajax request, since it's javascript and not CI. Again, try using a FULL url (http://yoursite.com/test/aj) or whatever in the ajax request...

Use a javascript console in your browser to see the ajax request and check if it's going to the right place.


ajax passing value in codeigniter - El Forum - 10-10-2012

[eluser]stv[/eluser]
console reply is "NetworkError: 404 Not Found - http://localhost/CodeIgniter_2.1.2/test/aj"


ajax passing value in codeigniter - El Forum - 10-11-2012

[eluser]alexwenzel[/eluser]
[quote author="stv" date="1349936156"]console reply is "NetworkError: 404 Not Found - http://localhost/CodeIgniter_2.1.2/test/aj" [/quote]

Means your ajax request goes to the wrong address or your controller dont respond the way you like. Is the controller itself working proper?


ajax passing value in codeigniter - El Forum - 10-11-2012

[eluser]stv[/eluser]
controller is working properly but all paths is not working properly, any problem in routes,config


ajax passing value in codeigniter - El Forum - 10-11-2012

[eluser]alexwenzel[/eluser]
If this is your path "http://localhost/CodeIgniter_2.1.2/test/aj” ...

- There could be a problem with special chars in url
- There could be a problem with your .htaccess
- There could be a problem with your routes.php

Just some ideas





ajax passing value in codeigniter - El Forum - 10-11-2012

[eluser]stv[/eluser]
Problem solved ,any how still have confusion about paths..thnx buddy


ajax passing value in codeigniter - El Forum - 10-11-2012

[eluser]alexwenzel[/eluser]
http://ellislab.com/codeigniter/user-guide/general/routing.html