我有一个简单的网站,单击按钮即可运行python程序,并将结果显示在div标签中。 但是,它不会逐行显示内容。
我在浏览器中检查了响应: 外观如下:
There are no Invalid Components
Wallet Information:
/te123i/oracle/admin/TE123I/wallet NOT_AVAILABLE
Displaying Central Inventory contents
Kindly Remove if there are any old entries of Oracle Home,
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2014, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
<SAVED_WITH>12.1.0.2.0</SAVED_WITH>
<MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
但是它像这样显示在前端:(单行显示全部输出)
Checking for invalid components.... There are no Invalid Components Wallet Information: /te123i/oracle/admin/TE123I/wallet NOT_AVAILABLE Displaying Central Inventory contents Kindly Remove if there are any old entries of Oracle Home, <?xml version="1.0" standalone="yes" ?> <!-- Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. --> <!-- Do not modify the contents of this file by hand. --> <INVENTORY> <VERSION_INFO> <SAVED_WITH>12.1.0.2.0</SAVED_WITH> <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER> </VERSION_INFO> <HOME_LIST>
这是我的JS代码:
$(document).ready(function(){
var b1 = $("#pre");
var btnClick1 = function(e){
alert("hey, you clicked RM button")
$.ajax({
type:'GET',
url:'cgi-bin/test.py', //
cache:false,
dataType: 'html',
data: $('form').serialize(), // Send the form data in the request.
success:function (result) {
$('#output').text(result);
}
});
}
b1.on('click', btnClick1);
});
反正我可以像响应一样以格式显示结果吗?
更新:推荐的帖子不一样。与PHP有关。