dongyu1918 2015-04-13 21:40
浏览 20
已采纳

api回调的格式响应

I am using php curl to receive data (ssl certificate) inspection but the data that comes back is one big lump of data in (according to firebug) it's in html format .. here is a sample of the output

HTTP/1.1 200 OK 
Date: Mon, 13 Apr 2015 14:10:05 GMT 
Server: Apache 
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com 
Set-Cookie: v1st=9C74FC61F2FB5493; path=/; expires=Wed, 19 Feb 2020 14:28:00 GMT; domain=.geotrust.com 
X-Powered-By: PHP/5.2.13 
Expires: Wed, 13 May 2015 14:10:05 GMT 
Vary: Accept-Encoding 
Cache-Control: max-age=604800, public 
Content-Type: text/html 

* Rebuilt URL to: https://www.geotrust.com/ 
* Hostname was found in DNS cache 
* Trying 69.58.181.102... 
* Connected to www.geotrust.com (69.58.181.102) port 443 (#0) 
* successfully set certificate verify locations: 
* CAfile: C:\xampp\htdocs\labs\test2\cacert.pem CApath: none 
* SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA 
* --- Certificate chain 
* 0 Subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; C=US; ST=California; L=Mountain View; businessCategory=Private Organization; serialNumber=3479750; O=GeoTrust, Inc.; OU=Infrastructure Operations; CN=www.geotrust.com 
* Issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust Extended Validation SHA256 SSL CA 
* Version: 3 (0x2) 
* Serial Number: 
* Signature Algorithm: sha256WithRSAEncryption 
* Start date: 2015-02-04 00:00:00 GMT 
* Expire date: 2017-02-03 23:59:59 GMT

It seems like each line is separated by a wildcard symbol * .. how can I cleanly output this data? currently i am just using

success: function (response) {
        $('#ajaxResponse').html(response);

Would be great if i could display certain data only but not sure how.

-- Here is the firebug -- enter image description here

  • 写回答

2条回答 默认 最新

  • dongyongmin5711 2015-04-13 21:49
    关注

    use a <pre> tag to indicate that it's pre-formatted.

    $("#ajaxResponse").html('<pre>' + response + '</pre>');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大