【发布时间】:2019-09-07 09:57:59
【问题描述】:
如果当 myJson 数组有 1 个对象时我没有任何问题,但 myJson 数组包含的对象多于 1 个对象,我会遇到无法执行后操作的问题。
var items = [];
$('.grid-stack-item.ui-draggable').each(function () {
var $this = $(this);
items.push({
ID: $this.attr('data-ItemId'),
x: $this.attr('data-gs-x'),
y: $this.attr('data-gs-y'),
Width: $this.attr('data-gs-width'),
Height: $this.attr('data-gs-height'),
UserDashboardId: $this.attr('data-dashboardid'),
content: $('.grid-stack-item-content', $this).html()
});
});
myJson = JSON.stringify(items)
console.log(myJson);
$.ajax({
type: 'POST',
url: '/Dashboard/SendItem/?json=' + myJson,
success: function (message) {
},
error: function (jqXHR, textStatus, errorThrown) {
alert("jqXHR:" + jqXHR.status + " errorThrown: " + errorThrown);
}
});
错误是 404 未找到
【问题讨论】: