显示jQuery的$就503错误响应 [英] Display jQuery $.ajax 503 error response

查看:143
本文介绍了显示jQuery的$就503错误响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示有503错误响应文件的响应。

 函数netbootupdate(){


$(#netbootstatus)HTML(更新..')。
  $阿贾克斯({
    键入:GET,
    网址:clientarea.php,
    数据:'行动=产品详细和ID ='+ $('#服务器ID)VAL()+'&放大器; modop =定制和放大器; A = netbootset和放大器; netbootid ='+ $('#netbootid)VAL()+。 '和;根='+ $('#根)VAL()
    超时:5000,
    成功:功能(数据){
      $(#netbootstatus)的HTML(数据);
      $(#状态)HTML('')。
    },
    错误:功能(数据){
      $(#状态)HTML(数据);
      $('#状态')addClass('errorbox')。
    }
    });
}
 

出于某种原因,数据并没有给我回复的内容。

解决方案

  $。阿贾克斯({
   // ...
   // [其他参数]
   // ...
   错误:函数(xmlReq,txtStatus,errThrown){
     $('#状态)文本(xmlReq.responseText).addClass('errorBox');
   }
});
 

我认为这就是你要的是什么,但不能肯定。无论哪种方式, xmlReq (因为我已经把它命名为)拥有的若干属性的与之相关的,您可以访问和参考。

I'm trying to display the response of a file that responds with an 503 error.

function netbootupdate() {


$("#netbootstatus").html('Updating..'); 
  $.ajax({
    type: 'GET',
    url: 'clientarea.php',
    data: 'action=productdetails&id=' + $('#serverid').val() + '&modop=custom&a=netbootset&netbootid=' + $('#netbootid').val() + '&root=' + $('#root').val(),
    timeout: 5000,
    success: function(data) {
      $("#netbootstatus").html(data);
      $("#status").html(''); 
    },
    error: function(data) {
      $("#status").html(data);
      $('#status').addClass('errorbox');
    }
    });
}

For some reason data doesn't give me the content of the reply.

解决方案

$.ajax({
   // ...
   // [other arguments]
   // ...
   error: function(xmlReq, txtStatus, errThrown){
     $('#status').text(xmlReq.responseText).addClass('errorBox');
   }
});

I think that's what you're going for, though not sure. Either way, the xmlReq (as I've named it) has several properties associated with it you can access and reference.

这篇关于显示jQuery的$就503错误响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆