0

I'm having a page call "mycontent.html". When the user visits the url of this page, the page's template is returned by the server. In particular:

<body>
...
<div id="content1"> </div>

<div id="content2"> </div>
... 

</body>

Then there is an Ajax call back to the server to get the content of the 2 divs. (I know this is inefficient but let's assume that we need to accept this right now. The main reason was that the display functions were previously written in Javascript).

So far, everything works fine.

Then, if the user click on a link in "mycontent.html" to another page and then from that new page, click the browser BACK button, there is a problem.

You guess what, instead of the "whole beautiful page", its display the json string returned by the server to the Ajax call mentioned above.

So I am asking for your help on this. My goal is a better user experience in the context that I still have to use the Ajax call to load the content. Anything satisfies this would do.

Thanks a lot in advance.

Paul Hoang
  • 1,014
  • 2
  • 11
  • 21

1 Answers1

0

It so appears that I came across this post about converting python obj to JS: Django Template - Convert a Python list into a JavaScript object

The initial purpose of the Ajax is due to the rendering being written in JS. Now with this method, I can still render using JS but not through the AJAX but through converting the data sent directly from the server to JS.

Thanks guy for reading.

Community
  • 1
  • 1
Paul Hoang
  • 1,014
  • 2
  • 11
  • 21