赶上ajax获取错误

I have the following javascript function which does ajax $.get.

function make_draggable(elements)
{
    /* Elements is a jquery object: */

    elements.draggable({
        containment:'parent',
        start:function(e,ui){ ui.helper.css('z-index',++zIndex); },
        stop:function(e,ui){

            /* Sending the z-index and positon of the note to update_position.php via AJAX GET: */


            $.get('ajax/update_position.php',{
                  x     : ui.position.left,
                  y     : ui.position.top,
                  z     : zIndex,
                  id    : parseInt(ui.helper.find('span.data').html())
            });

        }
    });
}

But unfortunately my application is not working. I would like to catch the ajax error. any help would be really helpful.

See the documentation. $.get returns a jqxhr object, which you can call fail on and pass a callback.

$.get(etc).fail(function (jqXHR, textStatus, errorThrown) {
    alert("There was an error. Look in the browser's JS console for details.");  
    console.log(jqXHR);
    console.log(textStatus);
    console.log(errorThrown);
});