亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從jquery $ .ajax到angular $ http

從jquery $ .ajax到angular $ http

慕俠2389804 2019-11-22 15:44:18
我有一段能很好地跨源工作的jQuery代碼:jQuery.ajax({    url: "http://example.appspot.com/rest/app",    type: "POST",    data: JSON.stringify({"foo":"bar"}),    dataType: "json",    contentType: "application/json; charset=utf-8",    success: function (response) {        console.log("success");    },    error: function (response) {        console.log("failed");    }});現在,我試圖將其轉換為Angular.js代碼,但沒有成功:$http({    url: "http://example.appspot.com/rest/app",    dataType: "json",    method: "POST",    data: JSON.stringify({"foo":"bar"}),    headers: {        "Content-Type": "application/json; charset=utf-8"    }}).success(function(response){    $scope.response = response;}).error(function(error){    $scope.error = error;});任何幫助表示贊賞。
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 725 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號