相关疑难解决方法(0)

使用JSON POST请求

我正在尝试使用JSON来启动对API的POST请求.

我找到了一些示例代码,在我走得太远之前我想让它工作,但我被卡住了......

<html>
<head>
<script type="text/javascript">
function JSONTest()
{
requestNumber = JSONRequest.post(
    "https://example.com/api/",
    {
        apikey: "23462",
        method: "example",
        ip: "208.74.35.5"
    },
    function (requestNumber, value, exception) {
        if (value) {
            processResponse(value);
        } else {
            processError(exception);
        }
    }
); 
}
</script>
</head>
<body>

<h1>My JSON Web Page</h1>


<button type="button" onclick="JSONTest()">JSON</button>

</body>
</html> 
Run Code Online (Sandbox Code Playgroud)

这是一个.html文件,我在chrome中运行.单击按钮时没有任何反应......

我想我错过了一段解释JSON响应并可以显示的javascript?否则任何其他建议?

javascript api post json

13
推荐指数
1
解决办法
11万
查看次数

标签 统计

api ×1

javascript ×1

json ×1

post ×1