How To Add GET Parameters To POST Requests

There are times when you need to pass GET parameters to a POST request. A common example is when you have a page with filters applied, and after submitting a form via POST, you want to refresh part of the page while preserving those filters.

HxRequest provides a way to include GET parameters in a POST request.

Passing GET Parameters in a POST Request

To include GET parameters in a POST request, set use_full_path=True in the template tags.

<button {% hx_post 'my_hx_request' use_full_path=True %}></button>

Why Is This Needed

hx-requests does not provide direct access to the current URL when using hx_get or hx_post. This means you cannot manually append ?param=value to the request URL in the template (though that isnt pretty anyway).