Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:21:56+00:00 2026-06-14T09:21:56+00:00

Is there some code I can add to Jeditable to raise an error if

  • 0

Is there some code I can add to Jeditable to raise an error if the XHR request I’m using returns something other than HTTP 200 (e.g. if there’s an internal server error or the server times out completely)?

I tried adding the callback parameter (below), but it only seems to fire when the AJAX request is successful…

   $('.foo').editable('/user/ajax_edit_full_name', 
       {
        indicator: 'Saving...',
        cancel : 'Cancel',
        submit : 'Save',
        cssclass : 'editable',
        callback : function(value, settings) {
             console.log(this);
             console.log(value);
             console.log(settings);
         }
       }
   ); 

Update: Further to Bruno’s answer, besides the ‘status’ property, xhr has, amongst other things, xhr.statusText. So in my case, if they specify an empty name (which is invalid) I’ve set the server to send an error 400 plus a custom message, and the latter is displayed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:21:57+00:00Added an answer on June 14, 2026 at 9:21 am

    Accordingly to the Jeditable source code there’s a parameter called onerror

    @param Function options[onerror]  function(settings, original, xhr) { ... } called on error
    

    Thus, it’s possible to achieve what you are trying to do by adding the parameter onerror on your editable function. The onerror parameter expects as argument a function in the following format:

    function(settings, original, xhr) { ... }
    

    Where the xhr parameter is your XHR Object. So, instead of trying to catch the error on your on, you can simply treat then inside your onerror function. Like the following:

    $('.foo').editable('/user/ajax_edit_full_name', 
    {
        indicator: 'Saving...',
        cancel : 'Cancel',
        submit : 'Save',
        cssclass : 'editable',
        onerror : function(settings,original,xhr){
            alert("It wasn't possible to edit. Try again");
            console.log("XHR Status: " + xhr.status);
        },
        callback : function(value, settings) {
             console.log(this);
             console.log(value);
             console.log(settings);
         }
    }); 
    

    I hope it helped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using .net. Is there some code somewhere that can change $11,456.50 -> eleven
is there some 'where' type contraints in can add to make the follwing code
Is there some simple code that I can add to an .htaccess file or
is there some ruby code I can use to install a gem from a
Is there some tool that can automatically convert the following c style code A
I was refactoring some code and found there are two places that can be
There is some problem, i can't understand anyway. look at this code please <script
There is some code that I am using written by someone else that I
i'm using DbSimple, but there is some code which i could write into another
There is some code that I'm trying to convert from IList to IEnumerable :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.