JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 30th, 2009, 02:01 AM
75Miles 75Miles is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 19 75Miles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 41 m 20 sec
Reputation Power: 0
Ajax Record Getter

I have no idea what to call this. I am a PHP programmer new to Axax, JQuery etc... I'm building a classifieds site for a client and would like to have a panel with rows of classified ads that updates via AJAX every 10 seconds or so if there's new ads, w/o reloading the page. I am not sure if this site is doing that but the effect would be the same:

http://www.classifieds.myspace.com/

So every ten seconds it would query the database (maybe it has to trigger a PHP script) and check for new posts, and if so, scroll down to add one new one...

Ideas on what this is called, any classes or libraries that can do it or direction to get started?

Reply With Quote
  #2  
Old October 30th, 2009, 10:48 AM
haydenchambers haydenchambers is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2009
Location: Madrid
Posts: 620 haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level)haydenchambers User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 5 Days 7 h 55 sec
Reputation Power: 393
Send a message via Google Talk to haydenchambers Send a message via Skype to haydenchambers
hi 75 miles,
jquery is a really easy way to get started espcially if you're familiar with css (in order to select items you want to manipulate)

//index.html
Code:
<div id="table_holder">

	<table>
		<tr>...etc
	</table>

</div>

//index javascript
Code:
<script type="text/javascript">
$(document).ready(function(){
//when the document is ready do this function
new_ad_timer = setInterval("update_ads()", 10000);
//every 10 seconds call the update_ads function
});

function update_ads() {
	$("#table_holder").load("getAds.php", {category: 2, sub_cat:5}, function(){
		//translates to get the element with id table_holder and load into it the echoed results of the getAds php page
		//when we call getAds.php we are sending two post vars $_POST['category'] and $_POST['sub_cat'] (if something like that is useful)
		//when the content has been loaded into the div element do a simple alert
		alert("table updated");
	});
}
</script>


getads.php would do a simple db query (perhaps using the posted values) and echo out the results in a table
__________________
working on goggle wave... it's like google wave but there's lots more beer involved

Reply With Quote
  #3  
Old October 30th, 2009, 02:09 PM
75Miles 75Miles is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 19 75Miles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 41 m 20 sec
Reputation Power: 0
awesome thank you.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Ajax Record Getter


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek