How to pass multiple parameters in a single Ajax function?

Help me read this Javascript and pass the right parameters?

  • I'm trying to implement some AJAX features in a project, and need help deciphering the possible options and parameters of the http://openrico.org/rico/home.page framework's http://openrico.org/rico/demos.page?demo=rico_accordion display. Specifically, I want to use it as a left-side site menu, ala Outlook. But to be useful, I think it needs to remember its open state as the user moves from page to page -- rather than resetting to a default state each time. The Rico http://openrico.org/rico/download_file/current_build/rico.js has an accordion section which mentions parameters like lastExpandedTab and onLoadShowTab, but I'm not JS-savvy enough to figure out how to achieve what I'm after.

  • Answer:

    The according feature is used to show and hide divs, it's unrelated to AJAX and can be used on static content. If you want to remember the open state when moving from page to page, you'll need to pass the information along and have the proper div opened on the new page using a server side language. If an "Outlook" look is what you're going for, why are you having users move from page to page at all? Why not simply refresh the content part of the page using AJAX and not modify the left hand Outlook-style accordion section?. This would make the menu not reset automatically, with no work on your part. Also, it doesn't look like lastExpandedTab is an option. I believe it's used internally by Rico to determine how to animate the div transformations.

Tubes at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

You're right, I was lumping the accordion menu under 'AJAX' inappropriately. I'd consider refreshing page content w/AJAX, except that this is for a site with all the other architecture in place. Individual page URLs were deemed important for SEO. So I'm really just trying to add a menu to the project. I found that altering onLoadShowTab in the .js file from 0 to x does change the open tab behavior, but passing {onLoadShowTab:2} as a parameter from the page doesn't seem to do it.

Tubes

It seems like your technique should work. Is it giving you an error? (You can check by loading the page in firefox and going to tools->javascript console)

null terminated

Hmm. The console shows the same vague error in the css file whether my added {onLoadShowTab:2} parameter is in the page script or not: Error: Selector expected. Ruleset ignored due to bad selector.

Tubes

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.