I composed a response to this a few days ago but it appears that reply 
never got posted, so I'll try again...

Yes, you understand correctly. My 'Stats' link in my 'Main' screen loads 
the 'Stats' screen via AJAX. As previously posted, I realized later that 
"the window.location.reload(true) statement does not access the the 
stats.php file". And yes, using the back button and reloading the page from 
the 'Stats' link certainly refreshes the data as it is a new call to the 
stats.php file. I was just trying to implement something a little more 
intuitive and easier. ;)

While it is now obvious to me why window.location.reload(TRUE)would not 
work as I first hoped (I code late at night when I'm tired :D,) and I 
understand what it 'should' do, I'm still unclear of what it is doing, if 
anything, in this case.  "So yes of course, if you reload index.php, the 
server loads what's in index.php.  Aka only the 'home' screen." however... 
 in this case, when I touch the 'Refresh' button on the 'Stats' screen, 
executing the windows.location.reload(true) function, the button highlights 
and leaves me on the 'Stats' page... so obviously not reloading the 
index.php. While I don't need to use this function here, it bothers me when 
I don't understand something, so I'm going to experiment some more.

I did think about hunting down some of the internal iUI functions to help 
with this but decided writing the function was a quicker solution. Thanks 
for pointing me in the right direction, I'll look into those iUI functions 
when I get a chance.

Jeff

On Wednesday, March 6, 2013 9:32:26 AM UTC-7, Remi Grumeau wrote:
>
> 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)" <fjr...@gmail.com <javascript:>> 
> 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 iphonewebdev...@googlegroups.com <javascript:>. 
> > To post to this group, send email to 
> > iphone...@googlegroups.com<javascript:>. 
>
> > 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 iphonewebdev+unsubscr...@googlegroups.com.
To post to this group, send email to iphonewebdev@googlegroups.com.
Visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to