mgtm3
asked on
how can i make ajax call a php file every one second using javascript?
i have a script that gets the updates from a database and i thought i would be cool if i make it ajax so that the script updates every one second with out clicking on refresh
can i have a script?
can i have a script?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you striker46 it works great just one problem the things that comeback from the boo.php is in arabic and when i get them back in ajax i get them not in arabic but in ý ýýý how can i fix this
Let's see if I understand it well: the data retrieved from the MySQL database is stored there in arabic, but it is appears in the page as ýýýýý? Could be related with encoding...
ASKER
noo when i get the data not using ajax i get it in arabic but now in ajax i get it all wrong
Can you please post the code you use to retrieve the data without AJAX?
I'll do some tests meanwhile
I'll do some tests meanwhile
ASKER
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<?php
include 'sql.php';
$select ="SELECT * FROM posts order by id desc limit 50";
$re = mysqli_query($mysqli,$sele ct);
?><table width="100%"><?php
while ($row=mysqli_fetch_array($ re)){
?>
<tr><td><table align="right" ><tr align="right"><td><div align="right"><a href="get.php?id=<?php echo $row['id'];?>">more>></a>< /div></td> <td ><div align="right">
<?php
echo $row['topic']." ".$row['posts']." *9DJB "." ".$row['forumid'];
?>
</div>
<font style="font-weight:900"></ td><td><di v align="right"><?php echo $row['id'];?></div>
</td>
</tr></table></td></tr>
</font><?php } ?>
</table>
<?php
include 'sql.php';
$select ="SELECT * FROM posts order by id desc limit 50";
$re = mysqli_query($mysqli,$sele
?><table width="100%"><?php
while ($row=mysqli_fetch_array($
?>
<tr><td><table align="right" ><tr align="right"><td><div align="right"><a href="get.php?id=<?php echo $row['id'];?>">more>></a><
<?php
echo $row['topic']." ".$row['posts']." *9DJB "." ".$row['forumid'];
?>
</div>
<font style="font-weight:900"></
</td>
</tr></table></td></tr>
</font><?php } ?>
</table>
ASKER
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256" />
<?php
include 'sql.php';
$select ="SELECT * FROM posts order by id desc limit 50";
$re = mysqli_query($mysqli,$select);
?><table width="100%"><?php
while ($row=mysqli_fetch_array($re)){
?>
<tr><td><table align="right" ><tr align="right"><td><div align="right"><a href="get.php?id=<?php echo $row['id'];?>">more>></a></div></td><td ><div align="right">
<?php
echo $row['topic']." ".$row['posts']." *9DJB "." ".$row['forumid'];
?>
</div>
<font style="font-weight:900"></td><td><div align="right"><?php echo $row['id'];?></div>
</td>
</tr></table></td></tr>
</font><?php } ?>
</table>
Try adding to the boo.php file the following line:
<?php header('Content-Type: text/html; charset=windows-1256');?>
Let's see if it helps.
<?php header('Content-Type: text/html; charset=windows-1256');?>
Let's see if it helps.
ASKER
hhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhh h striker46 you are my hero thanksssssssssssssssssss
Glad to know you got it to work!
"i thought i would be cool if i make it ajax so that the script updates every one second" (sic)
What is "cool" about dragging your page to its knees?