this.on('success', function(file, responseText) {
var theID = JSON.stringify(responseText);
alert(theID);
window.location.href = ('want to put something here');
});
警报正在给我:
{ “消息”: “成功”, “FILEID”:399}
我想获取fileID值,在这种情况下将是399。 谢谢。
答案 0 :(得分:3)
简单地
window.location.href = responseText.fileID;
将执行,因为responseText已经是JSON
答案 1 :(得分:1)
this.on('success', function(file, responseText) {
var theID = JSON.stringify(responseText);
alert(theID);
if(responseText.fileID == 399) {
// Do something
}
window.location.href = ('want to put something here');
});
答案 2 :(得分:1)
如果responseText已经是JSON格式,那么:
responseText.fileID
如果是String格式,则首先解析它:
var json = JSON.parse(responseText);
alert(json.fileID);