473,320 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Philosophical Question: responseText vs. responseXML

2
Hi all, in order to experiment with AJAX, I created a site called Rob's Easy Budget Tool (http://budget.edgerob.net). Check it out if ya like. I found its functionality useful so I made it available to all as well as source code & resources used.

In the course of making this site, I ran into a question. I exclusively use responseText to receive PHP backend responses. However, I ran into some limitations with this. If I wanted to update two different areas of the page for example, I had to do two separate xmlhttp queries with two separate responseTexts. This seemed wasteful. With responseXML, would I be able to get separate blocks of code with the same xmlhttp object request?

Is one method preferred / faster than the other? For example, to fill a table, I have PHP generate the table and return that as a block of HTML code in responseText. Is there a benefit to using responseXml to return the data, then JScript to create a table from that data?

Anyones experiences or opinions on this would be appreciated. Thanks all
Feb 6 '08 #1
4 3502
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

You may find this link useful.
Feb 6 '08 #2
crc294
2
Welcome to TSDN!

You may find this link useful.
Thanks for the response acoder. That was a very interesting article, especially the discussion that followed it in the comments.

Has anyone had personal experience with using JSON? Do you prefer it over XML?
Feb 6 '08 #3
gits
5,390 Expert Mod 4TB
Thanks for the response acoder. That was a very interesting article, especially the discussion that followed it in the comments.

Has anyone had personal experience with using JSON? Do you prefer it over XML?
i always prefer JSON ... when using ajax in my opinion we only should request data ... nothing else. it is bad practice to load entire html-documents or even fragments, or much worse: javascript sources ... that has to be evaled when loaded at runtime ... :)

so simply using JSON is giving you ready to use 'data-objects' ... that now should processed the way you need. you don't need to traverse dom-trees or whatever to read the data ... just use them :) ... it is less traffic ... since the XML-overhead is removed ... no tags, prolog, etc. ...

only one time i used XML - while calling a webservice with a XMLHttpRequest that returned the SOAP-response ... that is XML of course and you have to handle it that way ...

in case you use the XML/HTML as it is ... i think it could be preferable over JSON ... but typically you only need the data and in that case ... i would always prefer JSON ... as i said :)

kind regards
Feb 6 '08 #4
acoder
16,027 Expert Mod 8TB
Thanks for the response acoder. That was a very interesting article, especially the discussion that followed it in the comments.
You may also find the follow-up article useful too.
Feb 6 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: spark | last post by:
I have been experimenting with xmlhttprequest. (I am a javascript newbie, but familiar with programming with VB, Perl, and some PHP.) I am trying to see if it's possible to receive html snippets...
0
by: | last post by:
///======================in C# writeSession.aspx ///Session("loginID") == "tmp"; MSXML2.XMLHTTPClass xmlHttp = new XMLHTTPClass(); try { XmlDocument xmlDom = new XmlDocument();...
2
by: dondraper | last post by:
I have an application that uses a popular but simple set of JavaScript routines that implement an AJAX call used to populate a drop-down. It works for thousands of user but I have one customer...
5
by: furby | last post by:
I have this little bit of code : var request = false; var divid = 0; var fforie; try { request = new XMLHttpRequest(); fforie = "FF"; } catch (trymicrosoft) { try { //request = new...
1
by: Pugi! | last post by:
Currently I am using a responsexml for an xmlhttprequest. The information is then processed by javascript : elements are created with attributes incl events using setAttribute; in other words I...
6
by: mihirnmehta | last post by:
This is my code function getDetails() { var name = document.getElementById("movie_name").value; if (window.XMLHttpRequest) //For Mozilla Browsers { XMLHttp=new XMLHttpRequest() }
1
by: vunet.us | last post by:
My XML HTTP Request sends results in responseText. The result is an XML file I will need to parse. After research I determined that a cross browser XML parser will look like this: ...
0
by: rsoler | last post by:
Since i can not use cross domain in httpget i use GM and i get the text in responsetext but i need to use the request.responseXML.documentElement documentchild there is some javascript to convert it...
1
by: Dheeraj Gupta | last post by:
Hi all, actully i made one jsp and from there i have sended request in Ajax object for getting an XML file, that file i can see it by responseText property of Ajax but whenever i use responseXML...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.