0

I have saved some keys in html5 localstorage using JavaScript running on my views:

<script>
function setKeys()
{
 localstorage.setItem("key","some_value")
}
</script>

Now I want to access these values in one of my Rails controllers. How can I achieve this?

1
  • 2
    that was rude..anyway thanks for link.. i am new to Rails/Web Programming, what i m guessing is localstorage is on client side and if i have to access it in my controller, i should sent to rails app by some means, may be below answer by user2564200 points me in right direction(by using some ajax request) Commented Jul 12, 2013 at 17:15

1 Answer 1

4

You will have to send it to the controller via an AJAX request or something.

value = localstorage.getItem("key")
jQuery.ajax(some_url, { data: { key: value } })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.