Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6
This is the forum to discuss the Wrox book Professional Ajax, 2nd Edition by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780470109496
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 27th, 2010, 10:40 AM
Registered User
 
Join Date: Jul 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default chapter 3 question

on page 89-90 in the function checkComments...

Code:
if (aData[0] != iLastCommentId) {                   
                    
                    iLastCommentId = aData[0];
                    
                    if (iLastCommentId != -1) {                        
                        showNotification(aData[1], aData[2]);
                    }
                    
                }
Shouldn't
Code:
iLastCommentId = aData[0];
come after
Code:
 if (iLastCommentId != -1) {                        
                        showNotification(aData[1], aData[2]);
                    }
otherwise if there is already a comment when you get to the page, it will display, even if it was posted a year ago. If you make the change I'm suggesting, you would only see comments that were posted since you loaded the page. right?
Reply With Quote
  #2 (permalink)  
Old July 29th, 2010, 06:09 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Please keep in mind that this is just an example. :)

You're correct in that you'll get the last added comment. Whether you want that or not is, of course, dependent on the behavior you're after. It would actually be better to send a timestamp and only return comments after the page was loaded.
__________________
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 5 Question jltscaa BOOK: Beginning Microsoft Visual Basic 2008 ISBN: 978-0-470-19134-7 6 May 18th, 2010 08:39 PM
Chapter 5 Question 5 Will BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 1 October 24th, 2009 09:18 AM
Question on Chapter 5 arholly BOOK: Expert Access 2007 Programming ISBN 978-0-470-17402-9 1 September 2nd, 2008 04:07 PM
Chapter 4 question davidle1234 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 January 17th, 2007 11:18 PM



All times are GMT -4. The time now is 03:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.