•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,558 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,721 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1409 | Replies: 0
![]() |
•
•
Join Date: Jun 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I am new to AJAX but I have managed to get most of what I need done with AJAX on my site; except one thing that is still eluding me.
I am using ajax to post any new entries to the sites DB to the web page in random places (via DIVs). As I add the data to the database I get the resulting info shown on the screen via the periodicalupdater function just fine but as I add new items to the DB the old displayed data is removed and the new data is then displayed even though it is in a different location on the screen. Is there anyway to keep the old displayed data on the screen using the periodicalupdater function while adding new data using periodicalupdater? Thanks for any help in advance. PS, The data I am displaying contains unique DIV positioning coordinates. Below is the code I am using
note: prototype.js is already loaded
this is the function called
function checkping()
{
var <?php echo $holder;?> = new Ajax.PeriodicalUpdater('newPing','my.php', {method: 'post', frequency: 3.0, decay: 1});
}
</script>
this is the calling script
<script language="javascript" type="text/javascript">
checkping();
</script>
this is what is sent back to the ajax call via my.php. note the variables for top and left vary with each record posted.
<?php
echo
"<div style=\"position:absolute;
visibility:visible;
width:160px;
height:48px;
top:",$top_coord,"px;
left:",$left_coord,"px;
background-color:",$bgrcolor,";
border:2px solid #000000;
z-index:1\">
<img src=\"images/flags/",$flagfilename,"\" alt=\"country flag\" width=\"60\" height=\"32\" align=\"left\"><font size=\"-3\">", $usr_name, "
From: ",$country, "
", $pingText, "</font></div>";
?>
I am using ajax to post any new entries to the sites DB to the web page in random places (via DIVs). As I add the data to the database I get the resulting info shown on the screen via the periodicalupdater function just fine but as I add new items to the DB the old displayed data is removed and the new data is then displayed even though it is in a different location on the screen. Is there anyway to keep the old displayed data on the screen using the periodicalupdater function while adding new data using periodicalupdater? Thanks for any help in advance. PS, The data I am displaying contains unique DIV positioning coordinates. Below is the code I am using
note: prototype.js is already loaded
this is the function called
function checkping()
{
var <?php echo $holder;?> = new Ajax.PeriodicalUpdater('newPing','my.php', {method: 'post', frequency: 3.0, decay: 1});
}
</script>
this is the calling script
<script language="javascript" type="text/javascript">
checkping();
</script>
this is what is sent back to the ajax call via my.php. note the variables for top and left vary with each record posted.
<?php
echo
"<div style=\"position:absolute;
visibility:visible;
width:160px;
height:48px;
top:",$top_coord,"px;
left:",$left_coord,"px;
background-color:",$bgrcolor,";
border:2px solid #000000;
z-index:1\">
<img src=\"images/flags/",$flagfilename,"\" alt=\"country flag\" width=\"60\" height=\"32\" align=\"left\"><font size=\"-3\">", $usr_name, "
From: ",$country, "
", $pingText, "</font></div>";
?>
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- SBS 2003, IIS 6.0 & Squiremail stopped working together. (Windows Servers and IIS)
- Problems with PHP and the mysql_connect() command. (PHP)
- PHP work for a television show (PHP)
- PHP Form, SQL connectivity issues, please help. (MySQL)
- Problems with PHP mail function. (PHP)
- include function not working URGENT! (PHP)
- I am looking for works regarding php/mysql (Web Development Job Offers)
- Editing/Creating PHP Fields - Novice! Help? (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Drop down menu with images
- Next Thread: change input's bg image with js


Linear Mode