Sign In/My Account | View Cart  
advertisement

Article:
 Very Dynamic Web Interfaces
Subject: I realize that I'm on XML.com, but....
Date: 2005-03-29 22:32:16
From: w_laks
Response to: I realize that I'm on XML.com, but....

I got a question. How exactly do you return JS Objects in the response? What should be the document type. My server side php code is simply this:
<?php
echo "{ name: 'Lakshmi' }";
?>
This works but Mozilla keeps spinning forever I guess because it still expects more content or something. IE does not spin and on Opera this does not work at all presumably for lack of a HttpRequest object.

Previous Message Previous Message Move up to Parent Message Up Next Message Next Message


Titles Only Titles Only Oldest First
  • I realize that I'm on XML.com, but....
    2005-04-01 07:04:20 mdchaney [Reply]

    How exactly do you return JS Objects in the response? What should be the document type?


    Your code looks fine. Just use "text/plain" for the document type. When I do this locally, I simply use ".txt" files.


    I just finished a simple application for a client which has a 2.5M data file, the entirety of which is a humongous JS object literal. Loading it locally, including file reading, parsing, and object creation, takes about 2-3 seconds on my computer here (1.8GHz with plenty of RAM). The application is incredibly fast, particularly for dealing with a lot of data.


    Using XML DOM in such an application would bloat the data file by at least 25-30% (just looking at adding end tags), and bloat the code by an obnoxious amount by having to deal with DOM instead of simple object properties.


Sponsored By: