我开发了以下源代码,以便将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]