【发布时间】:2012-04-09 12:52:51
【问题描述】:
我正在尝试使用 jquery getJSON 方法向远程服务器发送 json-rpc 请求。这是我的代码:
json_string=JSON.stringify(obj);
var jqxhr = $.getJSON("https://91.199.226.106/ssljson.php?jsoncallback=?", json_string, function(data){
alert("aaaaaa");
});
jqxhr.error(function() { alert("error"); })
这是我的 json-rpc 字符串示例:
{"jsonrpc":"2.0","method":"merchant_check","params":[{"hostID":150999,"orderID":116,"amount":"150","currency":"051","mid":15001038,"tid":15531038,"mtpass":"12345","trxnDetails":""}],"id":116}
这是我得到的错误:
{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid JSON-RPC 2.0 request error (-32600)"}}
我不知道是什么问题。难道我做错了什么?也许我需要用 php 而不是 jquery 发送请求?那我该怎么做呢?
【问题讨论】:
-
任何你问这个问题的原因都没有在这里关闭/重写你的其他(重复)问题:
http://stackoverflow.com/questions/9988733/json-rpc-error-32600和这里:http://stackoverflow.com/questions/9871972/json-rpc-string -
添加 jQuery 标签,移除 JSONP 标签。
标签: php jquery json getjson json-rpc