JSON returns from AJAX calls

4 views
Skip to first unread message

markc

unread,
Feb 23, 2009, 8:48:41 AM2/23/09
to DOMAssistant
http://www.domassistant.com/demos/ajax-demo/ is the only real world
working example of how to use AJAX that I could find and it shows
using an eval for the 2nd JSON example but I notice in DA 2.7.4 that
it has a section that uses JSON.parse() if it's available.

Is it possible the ajax-demo link is out of date? If so is there an
actual working example somewhere demonstrating how JSON.parse() could
be used?

So far I've spent more time trying to work out how DA works than I
ever did with jQuery simply because there are so many jQuery examples
out there.

Mark Constable

unread,
Feb 24, 2009, 8:53:54 PM2/24/09
to DOMAssistant
Apologies for responding to myself but, from the same example page above,
I'm cofused as to why "#content-presentation" is used twice. Can anyone
explain what the the first one and second one actually do, or the difference
between them?

$("#container ul li:nth-child(2) a").addEvent("click", function (evt) {
$("#content-presentation").get(this.getAttribute("href"),
function (response) {
var json = eval("(" + response + ")");
$("#content-presentation").replaceContent(json.content.text);
});
return false;
});

--markc

Reply all
Reply to author
Forward
0 new messages