AJAX 呼び出しを介して問題が発生した場合に、テキストの下に返されるバックエンド CGI スクリプトがあります。
<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]
どうすればこれを解決できますか?