Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Mojolicious absolute url with query in template?

by Corion (Patriarch)
on Mar 19, 2020 at 09:25 UTC ( [id://11114461]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Mojolicious absolute url with query in template?
in thread Mojolicious absolute url with query in template?

You don't give any argument to ->query(), so the query part is empty. If you want query parameters, you have to give them to the method, like haukex already demonstrated.

<a href="<%= url_for('/')->to_abs->query( foo => 'bar' )%>"> Reload </ +a>

If you want to keep the current query parameters, you need to pass those into your template.

Replies are listed 'Best First'.
Re^4: Mojolicious absolute url with query in template?
by haukex (Archbishop) on Mar 19, 2020 at 09:48 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114461]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-28 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found