views:

17

answers:

0

Hi

Can someone tell me for what server request code does the 'error' option in jquery ajax ($.ajax) stand for? Because I want to handle the 400 server error, but I can't seem to do it using that 'error' option. I don't know if I'm doing something wrong in my code or whether it's a bug... Please I need your assistance. Thank you.

var options = {
    type: "post",
    target: "#responsePanel",
    beforeSend: function(){
        $("#uploadingImg").show();
        $("#polygonUploadPanel, #polygonUploadBtnHolder").hide();
    },
    complete: function(){
        $("#uploadingImg").hide();
        $("#polygonUploadPanel, #polygonUploadBtnHolder").show();
    },
    success: function(response, statusString, xhr, $form){
        $("#responsePanel").html(statusString);
        //map.polygonUploaded();
        $("#polygonUploadForm").hide();
    },
    error: function(response, statusString, err){
        $("#responsePanel").html(statusString);
        $("#polygonUploadPanel, #polygonUploadBtnHolder").hide();
        $("#polygonUploadBtn").hide();
        $("#ajaxUploadError").show();
        $(".errorHeading a").click(function(e){
            if($(".errorDetails").is(":visible")){
                $(".errorDetails").hide();
            }
            else{
                $(".errorDetails").show();
            }
        });

        if(response.status == 400) {
             $("#polygonUploadForm").show();
        }

        if(response.status == 601) {
             sessionTimedOut();
        }
    }
};
$.ajax(options);