Welcome Guest, Not a member yet? Register   Sign In
help, how can i retrieve a cookie value in a javascript file? im using mootols and i have an issue
#1

[eluser]fercho[/eluser]
hello,
im using mootools in my web page
take a look
www.tyresbolivia.com

but i'm having a problem,
i have links inside 3 sliders
when i press the links from a slider they redirect to a product page,
making the slider to close.

i want to keep the slider opened in which the product belongs.
so the only solution that i have is to pass with a cookie the slider number
and open it in the other page.

but i don't know how to do it.
please give me a hand
if you could address me to another solution i'll be very thankful.
#2

[eluser]Derek Allard[/eluser]
2 good CodeIgniter solutions for that type of thing would be the cookie helper and the session library.
#3

[eluser]fercho[/eluser]
yes, but i don't get how to call a cookie in a javascript file , could you give me an idea please??
#4

[eluser]Derek Allard[/eluser]
If you are trying to implement a non-CI solution, there are many smart people on these forums who would be willing to help you, but there are also other great places on the net to learn it.

Here's a good start. http://www.w3schools.com/js/js_cookies.asp
#5

[eluser]fercho[/eluser]
im willing to implement a ci solution because of that i want to know how to integrate this 3 things, ci , mootools and the cookies in javascript, ci is my first option, couldnt leave it.
i have searched the forums but i can't find a topic like this, please just a tip
#6

[eluser]Michael Wales[/eluser]
You can do something like this:

Code:
my_jsVar = '<?= $this->session->userdata('my_ciVar'); ?>';
#8

[eluser]fercho[/eluser]
thank you derek it will be my start, thanks again, you rock. i always visit your site.
and
walesmd can i do that in a <javascript> section??
#9

[eluser]Michael Wales[/eluser]
Worth a shot - I don't see why you wouldn't be able to. Of course, it wouldn't work in a .js file - but as long as it's a .php file it should work.

Give it a try and let us know.
#10

[eluser]fercho[/eluser]
yes, thaaaaaaaaanks again both of you , i will start right now to study all these great help you gave me, and i'll contact you with the fix, thank you very much.




Theme © iAndrew 2016 - Forum software by © MyBB