I am new to web-development and have built a website consisting of:
- index.html
- graph.html
- myScript.js
The graph.html is building up the content due to given parameter, specified on what you do in the main page (index.html
). After having a look here, I came up with this changePage call in my myScript.js
when a button is clicked:
$.mobile.changePage('graph.html', { dataUrl: 'graph.html?ip='+id, data: { 'ip': id }, transition: "slide", changeHash: true, reloadPage : true} );
Thereby, id
is just a String
(e.g.: load-21
) and I make an ajax-call with the help of the id
.
The resulting URL
looks like this: http://192.168.131.11:18069/CoDEViewTest/#graph.html?ip=load-21
Now the first call works fine, but if I hit refresh (F5) when I am on the graph.html
page, I automatically get back to the main page (index.html
), but I still have the same URL
(http://192.168.131.11:18069/CoDEViewTest/#graph.html?ip=load-21 ). The behaviour I would like to have, is that the graph.html
is reloaded. I found out that it works, if I call changePage like this:
$.mobile.changePage('graph.html?ip=' + id, { transition: "slide", changeHash: true, reloadPage : true} );
In this case,the URL
is a bit different (note: there is no '#' in the URL
): http://192.168.131.11:18069/CoDEViewTest/graph.html?ip=load-21
And in this case, when refreshing the page, I stay on the graph.html
.
Now my question is, what is the difference between these two calls? Also, from my first impression after googling, I think that the second call is not a good practise. Therefore, I would like to work with the first call, but I need to stay on graph.html
when refreshing the page..
Thanks