json 文字列をサーバーに送信するために、次のソース コードを開発しました。
httpRequest.open("POST", url, true);
httpRequest.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
httpRequest.onreadystatechange = function ()
{
if(httpRequest.readyState == 4 && httpRequest.status == 200)
alert(httpRequest.responseText);
}
httpRequest.send("parameters="+JSON.stringify(myJSONObject));
JSON.stringify(myJSONObject)
私のjsonデータが含まれています。send メソッドは次の例外をスローしますが、よく理解しています。
[Exception... "File error: Not found"
nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"
location: "JS frame :: chrome://___file.js :: method :: line 150" data: no]