Sunday, 15 June 2014

javascript - Refreshing a div that contains php include -



javascript - Refreshing a div that contains php include -

i have php code displays random file on pageload , on refresh. code in ../ads/food/responce.php see in other script below.

<?php $ad = glob("../ads/food/*.php"); $adfood = $ad[mt_rand(0, count($ad) -1)]; include ($adfood); ?>

i wanting rotate files displayed without having refresh page. ("like image slider does")

what have tried:

i have tried script refresh div, seems display warning , not file. can see error here http://whatanswered.com/food/what-can-i-do-with-cornflour.php

<script type="text/javascript"> $(document).ready(function() { setinterval(function() { $('#button').fadeout("fast").load('../ads/food/responce.php').fadein("slow"); }, 10000); }); </script> <div id="button"> <?php include("../ads/food/responce.php");?> </div>

it because path ("../ads/food/*.php") doesnt lead folder contains php (ie : http://whatanswered.com/ads/ads/food).

you have write path ../../ads/food/*.php lead http://whatanswered.com/ads/food/ (which contains php files)

php javascript html load

No comments:

Post a Comment