473,399 Members | 3,888 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,399 software developers and data experts.

AJAX without XML

I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...

Nov 23 '05 #1
17 1784


ps******@outplay.com wrote:
I wrote a small piece about AJAX without XML.
AJA?
Is anybody else doing it?


JSON <http://www.crockford.com/JSON/index.html> for instance was there
and used for data exchange between client and server long before the
term AJAX was coined.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 23 '05 #2
VK
Anyone knows a reputable source of info: who did first say AJAX ?

I tried to google out, but it seems like Homer's writing: "Seven cities
acclaimed the Homer's homeland" :-)

So who did coine this term?

Nov 23 '05 #3
"VK" <sc**********@yahoo.com> writes:
Anyone knows a reputable source of info: who did first say AJAX ? .... So who did coine this term?


I believe this was the one:
<URL:http://www.adaptivepath.com/publications/essays/archives/000385.php>

/L 'Reputable sources does not exist :)'
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Nov 23 '05 #4
VK

Lasse Reichstein Nielsen wrote:
I believe this was the one:
<URL:http://www.adaptivepath.com/publications/essays/archives/000385.php>
Thanks!
/L 'Reputable sources does not exist :)'


;-)

Nov 23 '05 #5
["Followup-To:" header set to comp.lang.javascript.]
On 2005-11-21, ps******@outplay.com <ps******@outplay.com> wrote:
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...


At work (treshna.com) we're experimenting with it.
our server app has a memory leak, (my fault - first attempt a multithreaded
code) tomorrow I will be chasing it if nothing more pressing arises.

If the server's up you can play with the working interface components
on port 8080 (or possibly 8081/8082 etc)

What we're doing is replacing a C based database front-end application's GTK
(gui) interface functions with HTML and javascipt...

We're using ascii/urelncoded queries and raw javascript responses
which are exec'd most testing is on mozilla 1.7 and firefox (debian
gnu-linux) with some verification on IE6 (win2k)

I lie, there is XML involved - the database front end is defined
at runtime by an XML file...

When it's all working atleast portions of it will be Free softtware.

Bye.
Jasen
Nov 23 '05 #6
ps******@outplay.com a écrit :
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...

mochikit AFAIK.
Nov 23 '05 #7
In article <11**********************@o13g2000cwo.googlegroups .com>,
<ps******@outplay.com> wrote:
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...


A lot a people are. The AJAX library I use uses JavaScript. Do a google
search for AJAX and Java and you will find the DWR library.

John

Nov 23 '05 #8
Certainly...

However I don't like the idea of sending javascript as a response to the
client and then eval it. Sounds like a maintentance nightmare. However
you could pass the response as a textual message and parse and process
it at the client. The textual message needen't be xml/soap webservice
whatever but could be your own designed optimized protocol since there
is a bit of overhead in xml/soap and the like and if you eg is providing
financial price updates a couple of times/sec using ajax the overhead
might come prohibitive.

/M
Nov 23 '05 #9
There's a thread in the TIBCO General Interface developer's forums
about using TIBCO's AJAX framework with Direct Web Remoting (DWR). DWR
claims to provide direct web access to java objects -- thus without
XML. More info @

https://power.tibco.com/forums/threa...D=682&tstart=0

ps******@outplay.com wrote:
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...


Nov 23 '05 #10
Using JavaScript as the data transport encoding is very popular and can
be extremely handy if your application is closed (ie you are not going
to provide the data to someone else). Furthermore, if the data you are
returning a single JavaScript object that needs to be used _in
JavaScript_ then by all means use JSON - it is much nicer than parsing
the XML DOM to look at values etc.

But if you are returning an array of data that needs to get into the
web page DOM (and will maybe need sorting / filtering on the client)
then use XML since XSL can be much easier to use for some people and it
can be re-used on both the client and server.

If speed is important you should also take into accound the browser
demographics when considering using JSON [1]. XML + XSL is far faster
than JSON in IE and vice-versa in Mozilla browsers. But depending on
your demographics then XML will likely scale better.

dave

[1] http://blogs.ebusiness-apps.com/dave/?p=45

Nov 26 '05 #11
da************@gmail.com wrote:
Using JavaScript as the data transport encoding [...]
I beg your pardon? The transport/transfer _encoding_ never was JavaScript,
but was and is US-ASCII, ISO-8859-XX or UTF-16, for example. Perhaps you
meant "data _format_" which is a completely different thing.
But if you are returning an array of data that needs to get into the
web page DOM (and will maybe need sorting / filtering on the client)
then use XML since XSL can be much easier to use for some people and it
can be re-used on both the client and server.


What are you talking about? An array is a data structure. If that is
returned, JSON is definitely the best format as the language it is built
on has built-in array support. Perhaps you meant returning a DOM subtree
with several child elements where XML would be more appropriate.
PointedEars
Nov 26 '05 #12
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote in message
news:16*****************@PointedEars.de...
da************@gmail.com wrote:
Using JavaScript as the data transport encoding [...]


I beg your pardon? The transport/transfer _encoding_ never was
JavaScript,
but was and is US-ASCII, ISO-8859-XX or UTF-16, for example. Perhaps you
meant "data _format_" which is a completely different thing.
But if you are returning an array of data that needs to get into the
web page DOM (and will maybe need sorting / filtering on the client)
then use XML since XSL can be much easier to use for some people and it
can be re-used on both the client and server.


What are you talking about? An array is a data structure. If that is
returned, JSON is definitely the best format as the language it is built
on has built-in array support. Perhaps you meant returning a DOM subtree
with several child elements where XML would be more appropriate.


In some cases, it can be preferable to just return a string with
semicolon separated values, and .split() it on arrival. If nothing
else, it is compact, and does not depend on any libraries being present.

--
Dag.

Nov 26 '05 #13
Dag Sunde wrote:
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote [...]
da************@gmail.com wrote:
Using JavaScript as the data transport encoding [...]

I beg your pardon? The transport/transfer _encoding_ never was
JavaScript, but was and is US-ASCII, ISO-8859-XX or UTF-16, for
example. Perhaps you meant "data _format_" which is a completely
different thing.
But if you are returning an array of data that needs to get into the
web page DOM (and will maybe need sorting / filtering on the client)
then use XML since XSL can be much easier to use for some people and it
can be re-used on both the client and server.

What are you talking about? An array is a data structure. If that is
returned, JSON is definitely the best format as the language it is built
on has built-in array support. Perhaps you meant returning a DOM subtree
with several child elements where XML would be more appropriate.


In some cases, it can be preferable to just return a string with
semicolon separated values, and .split() it on arrival. If nothing
else, it is compact, and does not depend on any libraries being present.


I can agree to that, in fact I did not debate it in the first place. What
I commented on were the terms "data transport encoding" and "array" being
wrongly used. I may be splitting hairs but I do think it is vital for a
developer, in fact for anyone in IT, to know the difference.
Regards,
PointedEars
Nov 26 '05 #14
I agree it is important for you to know the difference PointedEars. I do
admit that encoding was not necessarily the best word but it's really
just semantics. If you want to get technical, <a
href="http://www.dictionary.com">dictionary.com</a> says that <a
href="http://dictionary.reference.com/search?q=encoding">encoding</a> is
simply "To format (electronic data) according to a standard format"
(notice the use of the word format in there). I think that you are
assuming I was refering to is the <a
href="http://en.wikipedia.org/wiki/Character_encoding">_character
encoding_</a>.

Secondly, my reference to an _array_ was used as a general term. An
array <i>can</i> be a data structure but you really should understand
what an "array of data" is in the context of XML and JSON - can you
imagine what this means in C++ or Java? You can consider an array as a
group of objects/values formatted using either JSON or XML - again ask
dictionary.com what an array is. If someone says you have an array in
JSON then it might look something like this:
{'myArray': [
{'index1': 'value1'},
{'index2': 'value2'},
...]}
while an array in XML might look like this:
&lt;r&gt;
&lt;e a="index1" b="value1" /&gt;
&lt;e a="index2" b="value2" /&gt;
...
&lt;/r&gt;
Essentially both of those are a one dimensional list of objects.

Now that we all understand arrays and encoding we can get on with the
conversation. All that I am saying is that if you have a large _array_
of data (ie a list of, say, customer objects). If you use JSON to
transfer this data from the server to the client then you first have to
call eval(myJSONString) (which is slow) and then loop through the
resulting JavaScript array and build a string or DOM tree of the data
(which can also be slow) that is ready to be put into the web page -
this is not even considering the even slower cases where the data has to
be filtered or sorted. Alternatively, you can return the customer
records to the client as XML in which case all that has to be done is
the XML has to be transformed using an XSLT stylesheet into an HTML
string and then inserted into the document using the innerHTML property.
The XSLT can be used on the client or server (less logic written in
JavaScript :) ) and XSLT has great (fast) support for sorting and
filtering of data.

The important factors here are the length of the array of data you are
dealing with and the target browser. Given that XSLT is quite slow in
Firefox, the question becomes "is the performance hit on Firefox small
enough that the performance in Internet Explorer compensates given the
end user browser demographics".

The one time that JSON is really good is if you are returning a single
record like:
{'car':{
'color':'red',
'make':'Smart',
...}}
and you are going to either insert this into the page DOM or, even
better, you are going to check the color using JavaScript and then do
something else - nothing to do with the UI - based on the color of the
car. In these cases, JSON can be VERY useful.

happy AJAXing.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 27 '05 #15
ps******@outplay.com wrote:
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...


At least in IE 5+, you can do the same _without_ using either
XMLHttpRequest or the eval function.

Simply use a normal <script type="text/javascript" id="DATA" src= etc>
element, and then change the DATA.src value dynamically. (If you wish
the same file but a new version, do the usual src=name + "?ver=" + new
Date() trick.) IE will load (from cache or server) the new script
and evaluate it for you.

You can use this to load array data, functions, inline code, or
whatever. The same can be done with IE's <xml> element, for XML data.

I'd be curious to know if all other browsers support this dynamic
<script> src attribute change ability.

Cheers, Kevin

Nov 27 '05 #16
Kevin Darling wrote:
At least in IE 5+, you can do the same _without_ using either
XMLHttpRequest or the eval function.

Simply use a normal <script type="text/javascript" id="DATA" src= etc>
element, and then change the DATA.src value dynamically. [...]


I might add that you can also use this to preload multiple sets of data
or functions with the same internal names, and dynamically choose
between them. For example:

<script type="text/xml" src="version1.js"></script>
<script type="text/xml" src="version2.js"></script>
<script type="text/javascript" id="TEST"></script>

The scripts marked "text/xml" will not execute. Then you can do
TEST.src = "version1.js" or "version2.js" in your page, and the TEST
script contents will dynamically change to the desired script from
cache.

We have thousands of field techs who are off-line most of the time, and
we use a lot of caching techniques to provide the capablity of off-line
validation etc, on a daily per-job-type basis.

Cheers, Kevin

Nov 27 '05 #17
Kevin Darling said the following on 11/27/2005 2:19 PM:
ps******@outplay.com wrote:
I wrote a small piece about AJAX without XML.

http://www.softwaresecretweapons.com...AJAXWithoutXML

Is anybody else doing it? Please share your thoughts...

At least in IE 5+, you can do the same _without_ using either
XMLHttpRequest or the eval function.


And it is *much* more widely supported than the "AJAX" is. As for what
"AJAX" is, it is a common cleaning product in the USA.
Simply use a normal <script type="text/javascript" id="DATA" src= etc>
element, and then change the DATA.src value dynamically. (If you wish
the same file but a new version, do the usual src=name + "?ver=" + new
Date() trick.) IE will load (from cache or server) the new script
and evaluate it for you.

You can use this to load array data, functions, inline code, or
whatever. The same can be done with IE's <xml> element, for XML data.

I'd be curious to know if all other browsers support this dynamic
<script> src attribute change ability.


No, IE is the only one that supports changing the .src attribute. And
even then, it is the PC IE, IE on the MAC doesn't support changing the
..src attribute.
There is a thread in comp.lang.javascript that covers how to dynamically
load a .js file on the fly and which browsers support which methods.

The most widely supported method is to use createElement to create a new
script element and appendChild to append it to the document.

function loadJSFile(fileURL){
var JSFileToLoad = document.createElement('script');
JSFileToLoad.type = "text/javascript";
JSFileToLoad.src = fileURL;
document.getElementsByTagName('head')[0].appendChild(JSFileToLoad);
}

and then call it like this:

loadJSFile('someJSFile.js');

That is without the necessary feature detection since not all browsers
support gEBTN and appendChild

You could go one step further and append the script to a DIV tag and at
the beginning of the function remove the contents of the DIV tag so that
you discard any/all old JS files.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 27 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Yarco | last post by:
I want to use "Ajax" to create my web for hobby. But i don't know whether "Ajax" is mature... And what about with php? Someone have experience on it? ....
4
by: bobzimuta | last post by:
I'm creating a simple AJAX library. It's an object that will return an array containing the response text or xml. I'm trying to find a way to assign the response as a property of the object, but...
25
by: Elizabeth | last post by:
Can you all give me your best recommendation(s) for books on AJAX ? Thanks ... - E -
7
by: Thirsty Traveler | last post by:
Peter Bromberg has an interesting article eggheadcafe discussing AJAX libraries. He prefers ANTHEM.NET over AJAX.NET because it doesn't break the stateful page model. Our developers are currently...
5
by: geekboy0001 | last post by:
Just trying to get some opinions out there... There are tons of Ajax libraries out there... Ajax.NET Professional, ComfortASP.NET, ZumiPage, etc. etc... Microsoft has their own too, Atlas. I've...
2
by: =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= | last post by:
I don't see a managed newsgroup for just AJAX, so hopefully this is the best place to ask this question. Is there a sure-fire way to deploy an ASP.NET AJAX-Enabled web site to a web host who...
2
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
11
by: =?Utf-8?B?R2VyaGFyZA==?= | last post by:
I have run into a situation that if a page/tab that uses the Ajax toolkit (using .net version 3.5) is closed before the Ajax enable controls complete loading, then IE locks up. Does it in both IE7...
7
by: vjayis | last post by:
hi i hav a front page from which an ajax page is called and an text field is written in the front page using this ajax page. I need to validate the user access for this page: 1.the ajax page...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.