【发布时间】:2017-10-19 09:53:15
【问题描述】:
我需要将经过 base64 编码的图像发送到 API。 我的 json 输出只有 10000 个来自 base64 代码的字符。
var data = new Object();
data.image= $('#image').val();
data.date = new Date($.now());
console.log(JSON.stringify(data));
$.ajax({
type: "POST",
url: app.url
data: JSON.stringify(data),
contentType: "application/json",
crossDomain: true,
xhrFields: {
withCredentials: true
},
dataType: "json",
success: function (data, status, jqXHR) {
},
error: function (jqXHR, status) {
}
});
在我的 console.log 中,我得到了完整的字符串,但在请求中没有。
谢谢
【问题讨论】:
标签: jquery json ajax api base64