CodeIgniter Forums
pass javascript variables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: pass javascript variables (/showthread.php?tid=34627)



pass javascript variables - El Forum - 10-05-2010

[eluser]meera[/eluser]
how to pass javascript variables as argument
to controller.


pass javascript variables - El Forum - 10-05-2010

[eluser]SPeed_FANat1c[/eluser]
You can use jquery post method:

Code:
$.post("test.php", { name: "John", time: "2pm" } );

test.php is your controller, after slash you can add a method, like in browsers adress.
in your controller function you use e.g. $this->input->post('name');

you can read more there: http://api.jquery.com/jQuery.post/