Welcome Guest, Not a member yet? Register   Sign In
Unable to load jquery frustrated
#1

[eluser]Surrender[/eluser]
i put my jquery.js in C:/wamp/www/CIajax/scripts/jquery.js and i 'm pretty sure jquery.js could be used.

i echo my base_url() and the result is : http//localhost/CIajax/


so i included my jquery file like below :

src="<? php echo base_url().'scripts/jquery.js'"

i checked in firefox firebug and the js url shows: http://localhost/CIajax/scripts/jquery.js

what confused me is that it show no object could be use,and i find my jquery.js never loaded successfully

and my testing file in view like below

$lt;script$gt;

$(function(){

alert(" here is my testing ");
})

$lt;/script$gt;
help needed here
#2

[eluser]Sanjay Sarvaiya[/eluser]
make sure that in your config file
Code:
$config['base_url']  = 'http://localhost/Clajax';
I think you forgot Collen after http
#3

[eluser]Surrender[/eluser]
my config

$config['base_url']='http://localhost/CIajax/";
$config['index_page']='';

jquery include

and i echo my base_url() result: http://localhost/CIajax/

include file src="<?php echo base_url().'scripts/jquery.js'? >"

firebug in firefox shows src="http://localhost/CIajax/scripts/jquery.js"

PS:
i replaced my jquery.js on google
scr="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"


and it works . i wonder whether my jquery.js compatable problem
#4

[eluser]Surrender[/eluser]
[quote author="Sanjay Sarvaiya" date="1337663858"]make sure that in your config file
Code:
$config['base_url']  = 'http://localhost/Clajax';
I think you forgot Collen after http[/quote]


is there any difference between 'http://localhost/CIajax'

and 'http://localhost/CIajax/'

put http://localhost/CIajax/ in browser i works normally
#5

[eluser]Surrender[/eluser]
[quote author="Sanjay Sarvaiya" date="1337663858"]make sure that in your config file
Code:
$config['base_url']  = 'http://localhost/Clajax';
I think you forgot Collen after http[/quote]


my CIajax folder contents 3 subfolders and .htaccess index.php file


scripts application system

#6

[eluser]Sanjay Sarvaiya[/eluser]
[quote author="Surrender" date="1337664995"][quote author="Sanjay Sarvaiya" date="1337663858"]make sure that in your config file
Code:
$config['base_url']  = 'http://localhost/Clajax';
I think you forgot Collen after http[/quote]


is there any difference between 'http://localhost/CIajax'

and 'http://localhost/CIajax/'

put http://localhost/CIajax/ in browser i works normally
[/quote]

as per my information You can use any one of them, with slash or without slash. In my case both are working properly.
#7

[eluser]Surrender[/eluser]
[quote author="Sanjay Sarvaiya" date="1337667101"][quote author="Surrender" date="1337664995"][quote author="Sanjay Sarvaiya" date="1337663858"]make sure that in your config file
Code:
$config['base_url']  = 'http://localhost/Clajax';
I think you forgot Collen after http[/quote]


is there any difference between 'http://localhost/CIajax'

and 'http://localhost/CIajax/'

put http://localhost/CIajax/ in browser i works normally
[/quote]

as per my information You can use any one of them, with slash or without slash. In my case both are working properly.[/quote]


well. that's not the config problem .
where do you usually put you jquery and css file . and how to load these files ,still blur to me .any suggestions?
#8

[eluser]InsiteFX[/eluser]
This is wrong! The base_url should always have an ending slash on it.
Code:
$config['base_url']  = 'http://localhost/Clajax';

// should be
$config['base_url']  = 'http://localhost/Clajax/';

Also you should get into the habit of using lowercase directory and filenames!

CI directory structure:
Code:
ROOT
application
assets
  -- css
  -- images
  -- js
  -- etc
system
index.php
#9

[eluser]Surrender[/eluser]
[quote author="InsiteFX" date="1337668488"]This is wrong! The base_url should always have an ending slash on it.
Code:
$config['base_url']  = 'http://localhost/Clajax';

// should be
$config['base_url']  = 'http://localhost/Clajax/';

Also you should get into the habit of using lowercase directory and filenames!

CI directory structure:
Code:
ROOT
application
assets
  -- css
  -- images
  -- js
  -- etc
system
index.php
[/quote]

thanks research scientist

my question is

my config

$config['base_url']='http://localhost/CIajax/';

then then my list

CIajax

application
assets
--js
--images
--css
system
index.php
.htaccess

then how do i load files from the from assets/js? like below?

src="<?php base_url().'assets/js/jquery-1.4.2.min.js'?>" ?

i would really enjoy your reply asap
#10

[eluser]InsiteFX[/eluser]
Code:
<head>
// replace $ with s in script tags
    <$cript type="text/javascript" src="&lt;?php echo base_url('assets/js/jquery-1.7.2.min.js'); ?&gt;"></$cript>
&lt;/head&gt;

You can also place your scripts at the end of your html document.




Theme © iAndrew 2016 - Forum software by © MyBB