Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2009, 06:39 AM
Registered User
Join Date: Nov 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Cool need advice


Thanks to the authors for all your help!

I've another one for you:

I have a periodic refresh on my page. The responseText is HTML and I load it directly into a div....I figure this is faster than parsing XML.

However, now I would like that responseText to also return some parameters, to give me status information.

What is the best way to do this:

1. Combine the HTML code with the parameters and separate them with a delimiter like "||". Then use split and break them apart and load the HTML straight into the div. (This is kind of ugly, and could cause problems if the delimiter was located in the HTML)
2. Change it so that it's XML and that I parse the XML. I won't get the savings of just loading the straight HTML into a div anymore though. Then I could load the status information in there, as well as the data for the HTML.

p.s. I've decided to use XML instead of JSON. I tried JSON and the library I got from json.org has errors in it. I feel more comfortable with XML for a lot of reasons.
Reply With Quote
  #2 (permalink)  
Old December 9th, 2009, 09:58 PM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts

The best way is to separate the data and the markup with a string and then use split() to parse the response.

I find JSON much easier to use, but you could also create an XML document where one element is your extra data and another is your HTML.
Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Advice sarah lee ASP.NET 1.0 and 1.1 Basics 2 December 26th, 2006 12:11 PM
need advice from you alsafwa C# 2005 12 September 16th, 2006 07:44 AM
some advice please? liquidmonkey Java Basics 1 May 4th, 2006 08:54 AM
Need some advice wariental HTML Code Clinic 1 March 25th, 2006 09:48 PM
Advice 95_rifleman VB Databases Basics 2 February 13th, 2006 08:15 AM

All times are GMT -4. The time now is 08:02 AM.

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