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条)

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?