$.ajax({ type: 'post', async: true, data: { "security": "终端安全", "company": "000100010000", "days": 1, "rows": 10 }, url: 'http://***/Aqfk/api/DataHandler.ashx?license=abc@321', dataType: "json", success: function (res) { console.log(res); }, error: function (err) { console.log(err + "请求数据失败!"); } });
function curl_post($url, $data = array()) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // POST数据 curl_setopt($ch, CURLOPT_POST, 1); // 把post的变量加上 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $output = curl_exec($ch); curl_close($ch); return $output; } $url = "http://***/Aqfk/api/DataHandler.ashx?license=abc@321"; $data = array( "security" => "边界安全", "company" => "000100010000", "days" => 1, "rows" => 10 ); var_dump(curl_post($url, $data));
lockdatav Done!