jQuery Ajax error handling, show custom exception messages

前端 未结 21 2723
滥情空心
滥情空心 2020-11-22 01:50

Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message?

For example, if I want to throw an exception on the server side v

21条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 02:19

    $("#save").click(function(){
        $("#save").ajaxError(function(event,xhr,settings,error){
            $(this).html{'error: ' (xhr ?xhr.status : '')+ ' ' + (error ? error:'unknown') + 'page: '+settings.url);
        });
    });
    

提交回复
热议问题