Right on...looks easy enough.

Is response.html saying to display it as html? I tried making an array to
pass as json from php then json_encode it so my arrr was $response =
array('status' => true , 'view' => 'all my html code went here')

But when I returned my view data from the array it was all slahsed <// "//
/" / / like that.

-----Original Message-----
From: Ibatex [mailto:mjgris...@gmail.com] 
Sent: January-11-10 4:35 AM
To: jQuery (English)
Subject: [jQuery] Re: Ajax forms help

The beauty of json is that you can transfer alot of different data in an
organized way. You can very easily send back success/failure status along
with the html.

success: function(response) {
                        // Response was a success
                        if (response.status) {
                                //update my target div
                                $('#target_div').html(response.html);
                        // Response contains errors
                        } else {
                                // return the form with the errors

                        }

On Jan 10, 5:00 pm, "Dave Maharaj :: WidePixels.com"
<d...@widepixels.com> wrote:
> I need some help with a form.
>
> I submit the form fine, my problem is depending on the success or 
> failure of the form being saved. I will try to explain as simple as 
> possible
>
> form is in its own div <form here ..... >
>
> <div target> saved data will appear here</div>
>
> So what I need is i guess json success true or false response from the 
> form being saved or not then in my success
>
> success: function(response) {
>                         // Response was a success
>                         if (response) {
>                                 //update my target div
>                         // Response contains errors
>                         } else {
>                                 // return the form with the errors
>
>                         }
>
> But if I am returning json I cant return my normal html after the 
> successful save, and if I return my response as html there is no way 
> to tell the js what to do.
> The form or the target is html code
>
> How can I tell what the response was (true or false) and return the 
> appropriate html code for the appropriate form or target?
>
> Thanks
>
> Dave
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.725 / Virus Database: 270.14.130/2607 - Release Date: 01/10/10
16:05:00

Reply via email to