jquery ajax post 周边交通.json to server.html

    xiaoxiao2025-02-17  7

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>发送数据</title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function () { $("button").click(function () { $.getJSON("周边交通.json", function (data){ // console.log("data:", data); // console.log(JSON.stringify(data)); $.post( "http://localhost:8080/write/traffic", { name: "周边交通", data: JSON.stringify(data) }, function (data, status) { alert("数据: \n" + data + "\n状态: " + status); } ); }); }); }); </script> </head> <body> <button>发送一个 HTTP POST 请求页面并获取返回内容</button> </body> </html>
    最新回复(0)