0
我有一个后端CGI脚本,通过Ajax调用返回我下面的文字中出现问题时:JS更换功能不按预期工作
<p>A problem occurred in a Python script.
<p> /bin/cgi-bin/LOGS/tmpslM4pu.txt contains the description of this error.
我试图像下面显示出来:
$.ajax({
type: "POST",
url: "runcgi.py",
data:
{
'my_data' : 'test'
},
success: function(html)
{
if(..test for success..)
{
}
else
{
var StrippedString = $(html).toString().replace(/(<([^>]+)>)/ig,""); var StrippedString = $(html).toString().replace(/(<([^>]+)>)/ig,"");
$("p").html(StrippedString);
}
});
而下面是我的HTML代码:
<body>
<p></p>
</body>
但我看到下面的输出在我的浏览器:
[object Object]
我该如何解决这个问题?
使用console.log(html)在Firefox中使用Google Chrome或Firebug,然后在控制台视图中检查元素。 – Christian