Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
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.
Old December 9th, 2009, 09:58 PM
nzakas's Avatar
Wrox Author
Join Date: Dec 2004
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)

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.