JSONに失敗した - >応答が戻ってJSONの解析は、IE8
{"msg":"<DIV><P>Unfortunately we were unable to process your application.</p><BR>Please upload a CV<BR></DIV>", "status":"error"}
エラー
SCRIPT1015: Unterminated string constant
エラー
var data = $(this).contents().find('body').html();//I have console logged this and holds the above json as a string.
data = jQuery.parseJSON(data);// problem is here.
fの行を返さ何か理由があると思うのですが、それは.text()
が.html()
と反対の働きをしているからです.HTMLタグが付いているので、.html()
を使用する必要があります。
提案がありますか?
これはどのように機能しますか? ENTIREドキュメント(別名 'body')のhtmlを取得し、jsonのふりをしますか? –
var dataは '$( 'iframe')です。contents.find( 'body').html();'文字列として上の 'json'を持ちます。ie8でコピーしても動作しません返された上記のjsonを貼り付け、 'data = jQuery.parseJSON( '"
これは、iframeがhtmlシェルの中にjsonを持っていることを前提としています。サーバーは何を吐き出すのですか?未加工のjson文字列ですか?それとも本当に '
{msg:.....}'を発送していますか? iframeにbodyタグがない場合、そのjquery find()を使用することはできません。 –