Check Response With Ajax On Client

Hi

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,

});

		

request.done(function(response){

	/*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…

Thanx

Hi,

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

http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/

Works great Yureshwar.

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

Many thanx