Ajax Framework (CJAX) for Codeigniter 2.x+ |
[eluser]gwatt[/eluser]
Hi CJ, Using the site_url() function from the URL Helper doesn't make any sense. ----According to the Code Igniter manual --- site_url() Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your site index_page in your config file) will be added to the URL, as will any URI segments you pass to the function, and the url_suffix as set in your config file. ------ The site index page should be the Code Igniter "index.php" page and NOT the ajax.php page. base_url() is basically the same but without the final page. ----Again from the Code Igniter Manual ------- base_url() This function returns the same thing as site_url, without the index_page or url_suffix being appended. -------------- However here is the problem as soon as I change this $ajaxlink = "../../ajax.php?ajax_vocab/answer_question/" . $value['word_id'] . "/" . $currentWordArray['word_id'] . "/" . $answerCount; to this $ajaxlink = base_url() . "ajax.php?controller=ajax_vocab&function=answer_question&a={$value['word_id']}&b={$currentWordArray['word_id']}&c=$answerCount"; CJAX returns the crossdomain link and it doesn't work. Even though they end up pointing to exactly the SAME place which is http://uebusaito.com/engproj/ajax.php?aj...n/42/204/0 Shouldn't this work? As you said it is best practice to NOT hard code URLS... |
Welcome Guest, Not a member yet? Register Sign In |