Welcome Guest, Not a member yet? Register   Sign In
PHP Code in jQuery file
#1

[eluser]Mr.Data[/eluser]
Hello!
I am using a seperate js-file with jQuery code. At a certain point I would like to place this code:
Code:
$.post("<?= site_url('home/add') ?>", $("#form_id").serialize(), function(phpData) {
You see that there is the Codeigniter site_url() function but unfortunately you cannot use php code in a js-file. Of course I could just hardcode my site url at that place but isn't there a workaround so that I can still use Codeigniter's functions? What do you do when you have such a problem?




Theme © iAndrew 2016 - Forum software by © MyBB