[SOLVED] base_url in javascript |
[eluser]predat0r[/eluser]
Hi there, Time has come to put all of my JQ scripts to an external js file, I set a base_url variable for js in php, and referenced on it in js file, but the variable has some char addition inside.. In FireBug I see a plus '% 20' (with no spaces) in the url and that's because my scripts can't work. So, in FireBug console is shown: POST http://localhost/site/ % 20controller/method How can I remove this % item? Thanks Code: <.script> and js Code: ...
[eluser]Unknown[/eluser]
'% 20' is due to spaces.trim the values before submiting.
[eluser]predat0r[/eluser]
[quote author="InnovativePhp" date="1296773048"]'% 20' is due to spaces.trim the values before submiting.[/quote] Hmm, what to trim? base_url is fix, the other part (controller/method) is too. But I tried to trim base_url in javascript but nothing good.. EDIT: if I hardcode the url in js, it works. So the concatenation should put some extra char but why?!?
[eluser]predat0r[/eluser]
Solution: I have to put the ending php tag next to semicolon, this way all OK! <?php echo base_url();?> |
Welcome Guest, Not a member yet? Register Sign In |