Ajax-Form-Validation-Display-Errors

Hai everyone,

I got my all error messages in ajax response variable "data" as follws

i have logged in console i got this in my "Ajax response data"




Object {result: "error", msg: "Validation Error", err: "{"EpAccount_Bank_Name":["Bank Name cannot be blank…_Account_Name":["Account Name cannot be blank."]}"}



now i want to split that err array as key and value pairs.

I have tried with $.each(data.err, function(key,val))

but it returning each character as key.

Help me with this.

Thanks in advance.

paapi.

May i ask how that data was generated? maybe som some code?

Thanks for the reply

Actually i have validate the form in the controller with this code




            $error = CActiveForm::validate($model);

            if($error!='[]')

            {

                exit(json_encode(array('result'=>'error','msg'=>'Validation Error','err'=> "$error" )));

            }



so that i can able to get all errors back in my view.

Eventually i got the error. but i cant split them as key and value