Take the 2-minute tour ×

I am dealing with an application which is using a lot of graphics (the library Raphael and graphdracula). Basically, the application is drawing different graphs. Let's say that we have 3 pages which are drawing graphs:

  1. graph1
  2. graph2
  3. graph3

Let's say we have the following URL:


Now, this URL is going to load the page and the drawing algorithm for graph1. The way my application works now is: if I want to change the layout (say, to graph2), I will have to reload a whole page:


What I want to do is: to make this as a Single Page Application (SPA). When we load the application, I want all the graphs to be loaded, but only one to be visible (I guess this is the way to do it). When I click a button, just to load the stuff I need, not the whole page. Something like, when we open the application's page about graphs, to be:

www.someurl.com/graph#1 -> for the first graph
www.someurl.com/graph#2 -> for the second graph
www.someurl.com/graph#3 -> for the third graph

I want to this asynchronous. I tried to find something for Flask, but without sucess. Can someone please point me into the right direction how should I do this?

Thanks in advance!

share|improve this question
add comment

1 Answer

If that's not critical for you to support IE<10 - instead of old-style #hash-navigation, you can use jquery-pjax plugin to load page part by AJAX: https://github.com/defunkt/jquery-pjax

On Flask side - you will have to differ AJAX-requests by their headers or by some additional param like &ajax=1.

See also this question with comparison to history.js : jQuery-pjax vs history.js to load specific content when clicked

share|improve this answer
I would like to avoid adding new JavaScript libraries to the project (besides jQuery). Any way around that? –  Belphegor Mar 21 '13 at 14:56
You could write your own code for #hash-navigation. I had the same problem , IE7-9 doesnt' support jquery-pjax or history.js, and needs old-style #hash-navigation - and i haven't found some opensource javascript/jquery solution for AJAX-navigation supporting IE<10. So we decided to develop our own simple JS #hash-navigation solution for the project. If you find opensource jquery/JS solution supporting IE7-9 - please let me now as well, thanks. –  moonsly Mar 21 '13 at 17:03
add comment

Your Answer


