[form plugin]How to catch an error?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[form plugin]How to catch an error?

yellow1912-2

I'm using this plugin: http://malsup.com/jquery/form/
My datatype is Json. Everything works nicely, except the cases where
the php scripts may encounter some fatal errors and wont return data
in Json format then I don't  know how to catch that data to display.

It seems like the "success" callback is not called in these cases
(which is understandable btw), I was hoping it has something like
"error" callback but doesnt seem so.

Any help or suggestion is really appreciated

Thank your

Raine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to catch an error?

ggerri-2

Hi Raine

set the timeout and then the error callback:

e.g.

  // Ajax Parameter vorbelegen
  $.ajaxSetup({
      type:     'GET',
      timeout:  5000,
      async:    false,
      cache:    false,
      dataType: 'json',
      error: function(xhr) {
            $('#errorDisplay').html('Error: ' + xhr.status + ' ' +
xhr.statusText);
       }
     });

 $.ajax({
                 url: '/bla/bla/info.json',
                 data: { kz:escape($('#myVal').val()) },
                 success: function(json){  var vGood = $.trim(json
[0].good);
                                                                   $
('#Info').append('<b>goodstuff</b>');
                                                                }
    });

Regards ggerri




On Dec 21, 10:35 am, yellow1912 <[hidden email]> wrote:

> I'm using this plugin:http://malsup.com/jquery/form/
> My datatype is Json. Everything works nicely, except the cases where
> the php scripts may encounter some fatal errors and wont return data
> in Json format then I don't  know how to catch that data to display.
>
> It seems like the "success" callback is not called in these cases
> (which is understandable btw), I was hoping it has something like
> "error" callback but doesnt seem so.
>
> Any help or suggestion is really appreciated
>
> Thank your
>
> Raine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to catch an error?

yellow1912-2

Even though a bit late, I just want to say thank you very much

I changed it a bit and it works great for my case:
          error: function(xhr) {
                                displayMessage('Error: ' + xhr.status + ' ' + xhr.statusText + ' '
+ xhr.responseText);
Thank you again

Regards

Raine

On Dec 22 2008, 1:32 am, ggerri <[hidden email]> wrote:

> Hi Raine
>
> set the timeout and then the error callback:
>
> e.g.
>
>   // Ajax Parameter vorbelegen
>   $.ajaxSetup({
>       type:     'GET',
>       timeout:  5000,
>       async:    false,
>       cache:    false,
>       dataType: 'json',
>       error: function(xhr) {
>             $('#errorDisplay').html('Error: ' + xhr.status + ' ' +
> xhr.statusText);
>        }
>      });
>
>  $.ajax({
>                  url: '/bla/bla/info.json',
>                  data: { kz:escape($('#myVal').val()) },
>                  success: function(json){  var vGood = $.trim(json
> [0].good);
>                                                                    $
> ('#Info').append('<b>goodstuff</b>');
>                                                                 }
>     });
>
> Regards ggerri
>
> On Dec 21, 10:35 am,yellow1912<[hidden email]> wrote:
>
> > I'm using this plugin:http://malsup.com/jquery/form/
> > My datatype is Json. Everything works nicely, except the cases where
> > the php scripts may encounter some fatal errors and wont return data
> > in Json format then I don't  know how to catch that data to display.
>
> > It seems like the "success" callback is not called in these cases
> > (which is understandable btw), I was hoping it has something like
> > "error" callback but doesnt seem so.
>
> > Any help or suggestion is really appreciated
>
> > Thank your
>
> > Raine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "jQuery Plugins" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/jquery-plugins?hl=en
-~----------~----~----~----~------~----~------~--~---