<a class="removeApp" data-app="12">Close Something </a>
$('.removeApp').click(function (e) {
$.ajax({
async: false,
type: 'POST',
url: '@Url.Action("Remove", "Something")',
data: {
id: $(this).data("app")
},
success: function (result, data) {
console.log(this.data); //gives id=12
console.log (this.data["id"]) ///gives nothing how do i get just 12
}
})
});
我試圖獲取通過參數名傳遞的數據我該如何做?獲取通過Ajax調用成功後的參數值
您的數據來自哪裏?你剛剛得到一個「id = 12」的字符串嗎?在這種情況下,你需要解析字符串。 – 2013-02-17 21:38:37
from ancor data -app elements – 2013-02-17 21:43:06
你可以發佈你正在發佈的服務器方法嗎? – glosrob 2013-02-17 21:56:00