Check Response With Ajax On Client


I have a form in a dialog that I submit via ajax.

var $data=$("#dialogform").serialize();

var request = $.ajax({ 

  url: $url,

  type: "POST",

  cache: false,

  dataType: "html",

  data:	$data,




	/*update div in dialog OR close dialog and update div in main view*/


Depending on the view that was returned by the server, function(response) must either update the div in the dialog, or close the dialog and update the div in the main page.

What is the best way for this function to determine which view was sent by the server?

Maybe cookie, flag in response, headers…



Please check this url and perform what ever you want to do. In that example he has given with an ajax call.

Works great Yureshwar.

For those interested. The mentioned wiki returns json, which containes a flag (data.status) and the view.

Many thanx