2 回答

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊
request = $.ajax({
url: urlAction + '?id=' + id,
type: "get"
});
替換您的代碼
var urlAction = "@Url.Action("UpdateLikeVisitBrandPhoto", "Report")";
它產(chǎn)生
/Report/UpdateLikeVisitBrandPhoto
要點(diǎn)擊控制器,你需要你的網(wǎng)址
/Controller/Action?param1=paramvalue //single param
/Controller/Action?param1=paramvalue ¶m2=paramvalue //multiple params,apppend each paramname with prefix &

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超8個(gè)贊
由于您正在發(fā)送 POST 請(qǐng)求,因此您需要發(fā)送的參數(shù)不應(yīng)是 URL 的一部分。嘗試發(fā)送如下參數(shù):
request = $.ajax({
url: urlAction,
data: {id: id},
type: "POST",
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert("It worked!");
},
error: function () {
alert("Error");
}
});
- 2 回答
- 0 關(guān)注
- 288 瀏覽
添加回答
舉報(bào)