If i got it correctly, you have index.php with a "home" screen containing a
button "stat".
"Stat" button is <a href='stats.php'>.
stats.php contains a screen called "stats".
When you click on "stat" button, it loads the "stats" screen via Ajax and adds
it to the index.php and navigates to it.
So now we have a index.php containing a "home" view & a "stat" view.
Of course, the "stat" view does not exists in index.php by itself but has been
added to the actual DOM by the ajax call. Not in index.php itself.
Please note that if you press the back button and click on the "stat" button
again, it reloads the "stat" screen from stats.php and erase the previously
added one.
So yes of course, if you reload index.php, the server loads what's in
index.php. Aka only the "home" screen. You have to click the "stat" button
again to load the content of stats.php in it. aka "stat" screen. The DOM is
reloaded so everything Ajax added to it in your previous usage is obviously
removed.
Note that you can also use those internal functions
iui.ajax("stats.php", null, "GET",null, function(frag) {
iui.insertPages(frag);
});
Or something close to this :) (can't test this code right now)
Remi
Le 6 mars 2013 à 16:55, "Jeff (iUI Noob)" <[email protected]> a écrit :
> I guess it is working, just not doing what I was wanting it to do. :-(
>
> As mentioned, I have a link on the main screen that opens a 'stats' screen
> via AJAX, <a href='stats.php'>.
> This PHP script returns a div, <div id='Stats' ...>, that contains data from
> a mySQL database.
> If I understand correctly, the AJAX call places the output of stats.php into
> the main document, index.php, therefore the window.location.reload(true)
> statement does not access the the stats.php file. Although, if it were to
> reload index.php from the server, it would not yet have the 'Stats' div yet
> and no way of knowing where to look for it, so where does it reload the
> 'Stats' div from???
>
> My solution is to use the following function to perform the refresh:
>
> function refreshStats() {
> var xmlhttp = new XMLHttpRequest();
> xmlhttp.open("GET","stats.php",false);
> xmlhttp.send();
> document.getElementById('Stats').innerHTML=xmlhttp.responseText;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "iPhoneWebDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.