打開瀏覽器->f12->console,最好是http開頭的
#引入jq
var jquery = document.createElement('script');
undefined
jquery.src = 'http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js';
"http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"
document.getElementsByTagName('head')[0].appendChild(jquery);
$.ajax({ url:"http://127.0.0.1:7101/file/adminFileList",//發送的路徑 type:"get",//發送的方式 // data:'{"newsId":"5","type":"1","operation":"1"}',//發送的數據 contentType: "application/json", //提交數據類型 dataType:"json",//服務器返回的數據類型 success: function(data) { if(data.msg="success"){ alert("已提交成功"); }else{ alert("提交失敗"); } }, error: function (data){ alert("提交失敗"); } });