Question

I have 2 different url which are:

  1. index.php?r=admin/plan/list
  2. index.php?r=admin/user/list

And 2 accordion which have the id="user" and id="plan". Now I want to get the "plan" and "user" between the 2 slash in the url to identify which section I'm in and to let accordion decide which will be collapses.

Example: if I'm in user section, the accordion which had id="plan" will be collapse.

Is it possible to do that? Or have any better way to identify which accordion must be collapsed? Thank you so much.

Était-ce utile?

La solution

You can do this:

if(url.split('?')[1].split('/')[1] == "user"){
   $('#user').collapse(); // this is pseudo code
}
else{
   $('#plan').collapse(); // this is pseudo code
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top