![]() |
(Solved) jquery ajax base_url() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: (Solved) jquery ajax base_url() (/showthread.php?tid=48237) |
(Solved) jquery ajax base_url() - El Forum - 01-09-2012 [eluser]gazza7364[/eluser] Hi I'm trying to figure out how to get a url which puts the data into a div without using the full url. this is a snippet of the code in the controller:- Code: $host = 'music/'; Has you can see this is sent by json, which when loaded sends the data to jquery function contentDisp(). the jquery contentDisp() is as follows:- Code: function contentDisp(id) The problem i'm having, is the URL which I'm getting back is wrong. http://localhost/media/music/R.E.M/artist.html which should be http://localhost/music/R.E.M/artist.html. if I change $host to http://localhost/music/ everything works fine. Is their a way of writing this without using http://localhost. I have tried using base_url() but that then produces http://localhost/base_url()/music/R.E.M/artist.html.. Any help would be much appreciated. |