0

I have a htm code that also contains php within the same file. I want to refresh only a single div element of the page and not the full page. The reason being is that it contains images from a webcam and if I refresh the whole page the images will flicker. How can I refresh only the embedded php part of the html code (<?php echo $Door12; ?>)? I’m looking to refresh based on a set time inrterval.

<body>
<div id="parent">
<div id="subparent">
    <div class="image"><img src="http://##.##.##.##:##//CGIProxy.fcgi?cmd=snapPicture2&usr=myusername&pwd=mypassword&t=" width='640' alt='' /></div>
    <div class="divTable">
    <div class="divTableBody">
    <div class="divTableRow">
    <div class="divTableCell">12 --> <?php echo $Door12; ?></div>
    <div class="divTableCell">11 --> <?php echo $Door11; ?></div>
    </div>
    </div>
    </div>
    </div>
</div>
</body>
Lundin
  • 195,001
  • 40
  • 254
  • 396
blaudp79
  • 1
  • 1
  • 3
    What about AJAX? – lloiacono May 10 '17 at 13:55
  • did you think of Ajax with a set interval ? check answer from [THIS question](http://stackoverflow.com/questions/17529783/how-do-you-set-interval-to-ajax-call-in-jquery) – OldPadawan May 10 '17 at 13:57
  • 1
    yes, use Ajax, make a ajax get request, get the update, replace existing content. Done. – Ravish May 10 '17 at 13:58
  • Ok, so I wiil need something like this: setInterval(ajaxCall, 300000); //300000 MS == 5 minutes function ajaxCall() { //do your AJAX stuff here } – blaudp79 May 10 '17 at 17:03
  • Ok, so I will need something like this: setInterval(ajaxCall, 300000); //300000 MS == 5 minutes function ajaxCall() { //What code do I put here? } In most examples I find they call another php file as URL and it gets refreshed by the setinterval call. In my case I want to referesh a php piece that is embedded in the code I'm working on. – blaudp79 May 10 '17 at 17:10

0 Answers0