【发布时间】:2017-04-13 17:16:24
【问题描述】:
我有 AJAX 调用
这是代码
<script>
$(document).ready(function () {
email_update();
});
function email_update() {
$.ajax({
url: '@Url.Action("EmailsList", "Questions")',
contentType: 'application/json; charset=utf-8',
type: 'GET',
dataType: 'json',
processData: false,
success: function (result) {
var email = result;
// console.log(result[0].Name);
for (var i = 0; i <= email.length - 1; i++) {
var emailHTML = '<div style="margin-left: 25px; margin-top: 10px;>' +
'<b style="margin-left: 10px;">' +(i + 1) +
'<b style="margin-left:20px;">' + result[i].Email + '</b>'+
'<b>' +
'<b style="margin-left: 20px;">' +
result[i].Name +
'</b>' + '<a style="float: right; margin-right: 20px;">' +
'<img src="~/Images/Edit.png">' +
'</a>' +
'<a style="float: right; margin-right: 20px;">' +
'<img src="~/Images/Delete.png">' +
'</a>' +
'</div>';
$(".email_list").append(emailHTML);
}
}
});
}
但我遇到了麻烦
加载资源失败:服务器响应状态为 404(未找到)
但图片在文件夹中
我之前有这个代码(不是在 AJAX 中)<a style="float: right; margin-right: 20px;" href='@Url.Action("Edit_mail", "Questions", new {id = item.Individ_Id})'>
<img src='@Url.Content("~/Images/Edit.png")'/>
</a>
我的错误在哪里?
【问题讨论】:
-
在 ajax 之前是否有效,因为路径似乎是个问题
标签: jquery asp.net ajax asp.net-mvc