Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL params not working on root #122

Closed
stoem opened this issue May 2, 2017 · 10 comments
Closed

URL params not working on root #122

stoem opened this issue May 2, 2017 · 10 comments

Comments

@stoem
Copy link

stoem commented May 2, 2017

I'm new to navigo so please excuse if this is a false alarm.

I'm trying to pick up and process URL parameters. My code is as follows:
var router = new Navigo(null, false); router.on({ '/members': function (params, query) { console.log("/members route triggered"); } }) .resolve();

This works fine when I navigate to /members in the browser but fails to fire as soon as I add any kind of GET parameter and load it via the browser.

If I go to the console and test via router.resolve("/members?b=s") then the route fires and query params are available.

@krasimir
Copy link
Owner

krasimir commented May 2, 2017

Hey,

that's interesting. In theory should work. Here're some questions to clarify the situation:

  • Is it like you are refreshing the page with /members?something=here or you just add the parameter and hit Enter
  • That shouldn't be the case but are you sure that your server forwards that request (with the GET parameter) to the same html page where navigo runs

@stoem
Copy link
Author

stoem commented May 2, 2017

I navigate in my browser to /members, it loads. I can see the routing firing. We use navigo to check the route and make an AJAX call to feed data to a datatable on the page.

I then manually add /members?something=here to the URL to test it. I add it, hit return. Route doesn't fire. I refresh, still doesn't fire.
I need this because links from other pages will send this param.

Param or not, both routes load the same members/index page...

@stoem
Copy link
Author

stoem commented May 2, 2017

I tested my URL in extractGETParameters of navigo - it returns the expected result.
So that part works but that doesn't explain why the route does not fire. If there's a bug it'll be in that area.

@krasimir
Copy link
Owner

krasimir commented May 2, 2017

Sorry. One last thing, what's your browser?

@stoem
Copy link
Author

stoem commented May 2, 2017 via email

krasimir pushed a commit that referenced this issue May 2, 2017
krasimir pushed a commit that referenced this issue May 2, 2017
@krasimir
Copy link
Owner

krasimir commented May 2, 2017

@stoem can you please try the latest 4.7.1 version. That was a bug and should be fixed now.

@stoem
Copy link
Author

stoem commented May 3, 2017

Thanks, this works now.

@itsgratien
Copy link

i follows documentation but i don't how can i get params from url? @krasimir

@krasimir
Copy link
Owner

krasimir commented Feb 9, 2019

@itsgracian this is the section that you are searching for https://github.com/krasimir/navigo#parameterized-urls

@itsgratien
Copy link

@krasimir thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants