user1848515
user1848515

Reputation: 155

Navigate to pages using jquery with urls that have hash and parameters

I'm using jquerymobile.

Inside a page lets call it page1.aspx I have different sections like header, content, footer and navigate

So if i want to open the section navigate some href in other page page2.aspx must look like href="page1.aspx#navigate"

But how can I do the same but adding parameters? like href="page1.aspx#navigate?param1=2&param2=3, is this possible or how the syntaxis is?

Thank you.

Upvotes: 1

Views: 3917

Answers (1)

DigitalZebra
DigitalZebra

Reputation: 41613

Query params should come before hashtags in URLs, otherwise the query params will be counted as part of the hash tag. Here is what you want:

href="page1.aspx?param1=2&param2=3#navigate"

Just as a reference, here is the spec:

https://www.rfc-editor.org/rfc/rfc3986

See section #4.2, it talks about how to construct relative links.

Upvotes: 6

Related Questions