Results 1 to 2 of 2
  1. #1
    j_kathiresan is offline Member
    Join Date
    Feb 2008
    Posts
    22
    Rep Power
    0

    Default Handling Exceptions in front end with respect to back-end code

    The following code handles both success and failure types.

    jQuery.ajax({

    type:"post",
    dataType:"json",
    url: myAjax.ajaxurl,
    data: {action: 'submit_data', info: info},
    success: function(data) {
    successmessage = 'Data was succesfully captured';
    $("label#successmessage").text(successmessage);
    },
    error: function(data) {
    successmessage = 'Error';
    $("label#successmessage").text(successmessage);
    },
    });

    Will all the error come to the error section....RuntimeException - i.e checked and non-checked exceptions......

    OR only exceptions will be caught and NOT ERRORS..In java we have both ERROR and EXCEPTION classes

    Would like to know what will happen ??

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    25

    Default Re: Handling Exceptions in front end with respect to back-end code

    This has nothing to do with Java.
    The error and success callbacks are entirely based on what is returned from the server, so what response the server returns.
    A success is any 200 response, otherwise (I believe) it will fall into the error callback.

    So which one gets called will depend on how your server is set up to handle exceptions.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 9
    Last Post: 06-12-2014, 04:43 AM
  2. Replies: 1
    Last Post: 07-10-2012, 11:33 PM
  3. Replies: 0
    Last Post: 11-30-2011, 06:46 PM
  4. Data Exchange Format between Web Front End and Web Back End
    By jeanjiang in forum Reviews / Advertising
    Replies: 0
    Last Post: 06-25-2011, 02:37 PM
  5. Replies: 2
    Last Post: 02-04-2009, 03:11 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •