I have two problems with the same php/ajax solution. The first is a weird problem. Or maybe I’m just missing something.
i have a php page that displays data from a database.
so let’s say when it loads the first time, “myavalue” = 1.
On the same page i have a refresh button that triggers an ajax function to get the latest data from the database. If I change the value in the database from 1 to 2, and then use this button, the page does display 2. however, when i do a view source on the page, it shows the value 1 instead of 2.
Why is this? i’ve tried it both in IE 9 and also in fire fox.
The second issue may be related… the problem is with the same page that I mentioned above. When the refresh button is clicked, i’m actually generating html in my controller and then having my view display it. what i’m noticing is that in the view source, the html is missing a class name that i assign to my table cells. However, in my console, i can see that the html that the controller is generating does infact include the proper class names.
Here’s what the console is showing:
<tr><td>10.14.193.0/27</td><td>Vancouver Island</td><td class='deadclient'>2012-06-13 12:12:12</td></tr>
And here’s what the view source is showing:
<tr>
<td>10.14.193.0/27</td>
<td>Vancouver Island</td>
<td>2012-06-13 12:12:12</td>
</tr>
“View Source” is better worded as “View Original Source” (and I believe it is in some browsers). It is the source of the page before JavaScript had any say on the matter.
To view real-time source, use whatever Developer Tools your browser has. IE has the F12 Tools, Chrome has the Inspector, and Firefox recently added the Web Developer.
The point is that there is a difference between “View Source” and what is actually on the page. It’s like trying to look at the source of a stream by looking at where it meets the ocean.