Friday, 9 August 2013

Filter AJAX response with String or DOM manipulation?

Filter AJAX response with String or DOM manipulation?

I'm getting am AJAX response and need to trim it down to include only the
elements I want. From what I know I have two main options. First option
would be to manipulate the response as a string, using substring, split,
and other string methods then append a single time. The other option would
be to append to a dummy element and manipulate from there using jQuery
methods.
DOM manipulations are expensive and slow down my loading time. String
manipulations are a pain in the ass to code, feel increasingly "hacky",
and can become almost illegible. To me, both suck. What do you recommend I
use and/or could you suggest a different approach?
UPDATE:
The response comes in as a string and I can't do anything on the server side.

No comments:

Post a Comment