我们在对接接口的时候不仅可以在后端处理 , 同时也能在js的ajax上来请求获取api接口数据。代码如下:
function ClickTel() { var url = "http://flume.ttt.jjw.com/api/Shunt/Index"; var data = { Data: '{"AgentID":' + agentID + ',"AgentMobile":"' + agentPhone + '","HouseID":' + houseID + ',"PhonePosition":' + PhonePosition + ',"HouseSysCode":"' + houseCode + '"}', DataType: 3 }; setTimeout(function () { $.ajax({ headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, type: "POST", dataType: 'json', async: true, url: url + "?r=" + new Date().getTime(), data: data, xhrFields: { withCredentials: true }, success: function (e) { return; }, error: function (XMLHttpRequest, textStatus, errorThrown) { return; } }, 10); }