Naja and do parameter in URL

Ajax
Member | 59
+
0
-

Hello everyone!

I don't know what I do wrong. I used https://github.com/jiripudil/Naja for ajax. Ajax work as expected, url is changed as expected, but the problem is naja adds ?do= param into url. Is there some configuration or is it default behavior?

Thanks for answers!

Ondřej Kubíček
Member | 494
+
0
-

do adds nette itself, it is default behavior

Ajax
Member | 59
+
0
-

But not during ajax.. I mean when I use jQuery version of nette.ajax.js, do parameter is not added..

jiri.pudil
Nette Blogger | 1029
+
+2
-

Hello @Ajax,

the do parameter is indeed added by Nette, regardless of whether the request is asynchronous or not. The thing is that with synchronous requests, you usually redirect to the canonical URL (without the do parameter). With async request, you need to give Naja a hint as to what the canonical URL should be; please see the related docs.

(The parameter is seemingly not added in nette.ajax.js because it does not manipulate the browser history – that's something done by a separate extension. Naja, on the other hand, does include the behaviour of the aforementioned extension by default.)

Ajax
Member | 59
+
0
-

jiri.pudil wrote:

Hello @Ajax,

the do parameter is indeed added by Nette, regardless of whether the request is asynchronous or not. The thing is that with synchronous requests, you usually redirect to the canonical URL (without the do parameter). With async request, you need to give Naja a hint as to what the canonical URL should be; please see the related docs.

(The parameter is seemingly not added in nette.ajax.js because it does not manipulate the browser history – that's something done by a separate extension. Naja, on the other hand, does include the behaviour of the aforementioned extension by default.)

Great! Thanks! :)