AJAX - Do I need to return a full HTML document on the server side?

By : Brian G
Source: Stackoverflow.com

I am using JQuery to post with AJAX to another ASP page. Do I need this ASP page to return a full html page. Or can I just have it send back a value ( I just need a status ) . Here is my function.

	  url: "X.asp",
	  cache: false,
	  type:  "POST",
	  data:  queryString,
	  success: function(html){
By : Brian G


Using AJAX, you can return anything, even binary data. Although it was designed for XML, you can use it for anything you can transfer across a web server. However, HTTP Requests are expensive, so don't abuse them too much!

By : Malfist

You can return anything from the backend, I personally prefer JSON, but you have to specify the dataType property in your $.ajax options

By : Ahmad

Well, the whole point of AJAX is IMHO that you don't need to return the whole page. The server just sends the simple answer that you need.

This video can help you solving your question :)
By: admin