After an XHR request, the server response appears in the view source
I have a website where navigation is done using ajax, without reloading the page. Page loaded from the server using XMLHttpRequest, the server gives response in json format, the script pulls the html and writes the document.
So, if after was already committed at least one such query to open in the browser viewing the page's source code — there is code on the page is that the server I just gave json.
This is normal behavior? And is there a way to make there was just the page code, not the text of the last response from the server?
As it is not entirely clear what's going on. You can even code to show?
Dariu answered on October 8th 19 at 01:30
Most likely you're not the source of the page and the source code of the selected fragment (e.g., use the context menu item "Firefox") that dynamically generated based on the current state of the DOM tree.
greta_Anderson64 answered on October 8th 19 at 01:32
And asynchronous requests are used to implement navigation? In other words, you use history.pushState?
camille answered on October 8th 19 at 01:34
The browser behaves correctly in Your case. Try to do not GET /register/, and add any parameter, e.g. GET /register/?xhr, the Location to write /register/. Or try setting xhr to convey in the POST, but I'm not sure that would work.