You should use JSON if you have a set of data that you want to easily
parse (e.g. loop through) and put into a format of your own (via
Javascript). You should use HTML if you have a block of HTML to just
insert into the page, or if you just return very short and simple
data, like "true" or "false" or "1", etc.

If you return HTML with an <img> element, it will not download the
image automatically with your AJAX response. When you insert the HTML
onto the page (the DOM), the browser will render the HTML and download
the image at that point in time.

On Sep 29, 4:42 pm, Toaster <mr.toas...@gmail.com> wrote:
> Hello
>
> I got a couple questions concerning the use of AJAX for setting
> filters and generating results.
>
> -- When retrieving results, should I go json or html? each result item
> consists of more of less 7 elements, should I be generating this
> server-side (html) or clien-side (js)?
>
> -- Lets say I go html and there are images in the results. When it
> comes to the success part of the ajax call, does it mean it downloaded
> the images as well or just the html code?
>
> Thanks in advance.

Reply via email to