0

I created a simple widget based on the example provided at http://www.igvita.com/2007/06/05/creating-javascript-widgets-in-rails/

I currently invoke the widget using the following code:

<script type="text/javascript" src="http://yoursite.com/widget/user_bookmarks/A4923D2342JF">     </script>

However, I would like to pass it using a few options like:

  1. Number of bookmarks
  2. Layout: horizontal/vertical
  3. size:

Ideally, I would like to call it like:

  <script type="text/javascript"> 
      var widgetOptions = {
        key: 'A4923D2342JF',
        layout: 'horizontal',
        numBookmarks: 3;
       };

       http://yoursite.com/widget/user_bookmarks //Is this how you invoke?

How do I pass the options to the bookmarks widget controller?

Better yet, is is possible to leave the styling out of the rails code and let the user style is anyway they want easily?

1 Answer 1

1

Pass them as query string parameters:

http://yoursite.com/widget/user_bookmarks?key=A4923D2342JF&layout=horizontal&numBookmarks=3

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.