Welcome Guest, Not a member yet? Register   Sign In
how to put javascript??
#11

[eluser]husni[/eluser]
well..this is my structure..
Code:
...
   +system
      +application
         +controller,view,model

i put the folder javascript at the wwwroot.. i'll try to put the folder in my view folder just like you do..

*but i don't have .htaccess file..
#12

[eluser]maria clara[/eluser]
here’s my .htaccess maybe this can help



RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]
#13

[eluser]husni[/eluser]
i'll try the .htaccess after my javascript works..

i put my folder named javascript in view folder..
i put this code into my controller..
Code:
$this->load->view('javascript/example.js');

this is my example.js file
Code:
function peringatan()
{
    alert('Hello hehe');    
}

but the alert didn't appeared at all..

is my view file still need this??
Code:
<type="text/javascript" src="&lt;?=base_url()?&gt;javascript/example.js">[removed]
#14

[eluser]maria clara[/eluser]
ur calling a .js file from ur view to ur controller like this:

Code:
$this->load->view('javascript/script.js');

for example this is the code inside ur .js file

Code:
function js()
{
    alert('Hello hehe'); //<-- but this one is not showing right?
}


Quote:
Code:
<type="text/javascript" src="&lt;?=base_url()?&gt;javascript/example.js">

im using this line of code because im calling a javascript library
#15

[eluser]husni[/eluser]
yup! thats right..
it doesn't works..
and in my view file,it copy the coding and display the javascript code..
function peringatan() { alert('Hello hehe'); }..

how can i fix the problem?
#16

[eluser]maria clara[/eluser]
i have found a thread that may help a lot. check this thread http://ellislab.com/forums/viewthread/45055/




Theme © iAndrew 2016 - Forum software by © MyBB