What to return when making an Ajax request

Posted by Russell on Stack Overflow See other posts from Stack Overflow or by Russell
Published on 2010-05-05T09:45:30Z Indexed on 2010/05/05 9:48 UTC
Read the original article Hit count: 206

Filed under:

When we return data from an Ajax call, is it better to return a document containing HTML to display on the page or return an Xml/json data which can be processed?

I know different circumstances may determine what 'better' means, but I really want to know which will be more appropriate for different circumstances.

I am working on the framework for a large ASP .Net application, using jQuery Ajax (forms plugin). My initial thought was to return the data as Xml, then process accordingly. Then this increases processing required in Javascript, to populate the page. I am trying to balance flexible, clear and simple.

Thanks in advance for your knowledge and information.

© Stack Overflow or respective owner

Related posts about AJAX