I have problems to understand how the web pages are refreshed using jquery...
I start from this test page : http://www.sogival.com/m-index.php From there, I generate a list of areas from a sql database, each object of the list pointing to a web page with at the following url : http://www.sogival.com/m-area.php?page_id=1 (or any other number 1..7). But when I click on any of those links, I get an almost empty page, although the URL is correct, since the parts coming from sql are not populated. But what is strange for me is that if I hit the F5 key, then the page is displayed properly! And this is a real mystery for me... Why is the page not displayed properly the first time ?
I also have a second question : I would like to use the following script to populate 2 distinct areas on the jquery page, namely h3 and h4. However, what ever I do, only the first term (here h3) is populated, and the second stays empty! Could you explain me how to populate both ? Note that in this example, data.items.length = 1, so the for loop is only passed once.
<script type="text/javascript">
$(function(){
var list = '';
$.getJSON("http://www.sogival.com/m-fetch.php", // fichier
{"page": "dest", "page_id": 35, "lang" : "fr"}, // paramètres
function(data){ // fonction
for (var i = 0; i < data.items.length; i++) {
$("h3").append(data.items[i].name).listview("refresh");
$("h4").append(data.items[i].general).trigger("refresh");
}
});
});
</script>