jquery |
[eluser]einsteinity[/eluser]
hi, i'm newbie in codeigniter i am trying to link my page with external jquery.. i have tried to understand the tutorial about assets here. but i got stucked after this part Code: $route["asset/:any"] = "asset_controller/index"; can somebody give me an extra instruction to understand that part? what i am trying to do is to create a page with accordion effect (at this time, i haven't used that assets manager). i set my base url in config.php to Code: $config['base_url'] = 'http://localhost/ci/'; in my view file there is a piece of code like this Code: <link rel="stylesheet" type="text/css" href="<? echo base_url(); ?>css/styles.css" /> Code: <script type="text/javascript" src="<? echo base_url(); ?>javascript/jquery.js" ></script> i tried to run those page from browser and i got no problem with the css.. it's loaded properly, but the jquery file isn't loaded.. i open the "inspect element" in chrome browser, and found a message Failed to load resource: the server responded with a status of 404 (Not Found) i test to hover the css url shown in that inspect element tools, and the url is correct. but when i tried to hover the jquery url, the target url is different with the url shown in the inspect element tools it's shown like this Code: http://localhost/ci/A/javascript/jquery.js Code: http://localhost/ci/javascript/jquery.js please tell me what i have done wrong? i will send the complete code too if needed..
[eluser]Otemu[/eluser]
This does seem strange as all echo base_url() does is outputs your base url path, so it very strange your getting the extra 'A' when loading JavaScript, you sure you completely removed asset manager? anywhere you can put the site online to have a look as could be an encoding issue? or upload your code somewhere so we can take a look?
[eluser]einsteinity[/eluser]
argh.. i wanted to send the code just now and i noticed that i forgot to back up the code and lots of change have been done to this file.. if you could take a look at jquery accordion page in here. i copied the code from that page with a change in the javascript source which is located in xampp/htdocs/javascript/jquery.js so i write like this in the head area Code: <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> i think that it will be point to localhost/ci/javascript/jquery.js the file is located in xampp/htdocs/ci/javascript/jquery.js the code is located in a page call faq.php so i create a function in controller like this Code: class A extends CI_Controller{ the last action i tried to do is to move the jquery file outside the ci folder. and the code can work as what it should be.. but of course that won't be the permanent solution.
[eluser]InsiteFX[/eluser]
Code: // Repalce the $ with s in script tags Make sure the your ./application/config/config.php base_url ends with a slash. Normally we setup assets like this. Code: application Then your link would look like this. Code: // Repalce the $ with s in script tags
[eluser]einsteinity[/eluser]
the first solution is not working.. the target directory is now okay but i got a 404 error message from google chrome's inspect element.. the base_url has been rechecked.. the third solution got the same error with the first one.. :-(
[eluser]InsiteFX[/eluser]
It should be https// not http:// Code: <link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
[eluser]einsteinity[/eluser]
[quote author="InsiteFX" date="1339171217"]It should be https// not http:// Code: <link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> i tried to create a html page (not with CI), it can work with http.
[eluser]InsiteFX[/eluser]
Seems funny I can not download it without https://
[eluser]einsteinity[/eluser]
hmm.. i don't know why, but it works here. as long as i remember, i don't set anything to my browser to automatically force https connection back to the case.. is it because the controller or the htaccess file? |
Welcome Guest, Not a member yet? Register Sign In |