TypeError: Request constructor: HEAD or GET Request cannot have a body #174
-
Hello, I use Naja 2 first time and I migrating from nette.ajax.js. What I do wrong?
Error:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hello, Naja sends the I guess nette.ajax.js (or rather the underlying jQuery's $.ajax) puts given data into the query string for you? I think Naja could do the same, especially since it already does so when sending forms via For the time being, I believe something like this should work: const url = new URL({link changeYear!});
url.searchParams.append('year', '2020');
naja.makeRequest('GET', url); |
Beta Was this translation helpful? Give feedback.
-
nette sends to latte relative URL not abolute |
Beta Was this translation helpful? Give feedback.
-
thank you very much, it works |
Beta Was this translation helpful? Give feedback.
Hello,
Naja sends the
data
as a request body which is not supported forGET
andHEAD
methods – for those, data should be sent as part of the URL in the query string.I guess nette.ajax.js (or rather the underlying jQuery's $.ajax) puts given data into the query string for you? I think Naja could do the same, especially since it already does so when sending forms via
GET
🤔 (edit: 👉 #175)For the time being, I believe something like this should work: