Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取javascript中对象的值_Javascript_Jquery_Json_Object - Fatal编程技术网

获取javascript中对象的值

获取javascript中对象的值,javascript,jquery,json,object,Javascript,Jquery,Json,Object,我正在尝试使用date对象获取报税表。 但我不能和console.log的firebug我看到了你想要使用的值 我试图展示我的形象 我需要获取数据对象名称中返回的值 我的代码(js) $(函数(){ //"严格使用",; $('#fileupload')。fileupload({ url:“/resource/upfoto2.ashx”, maxNumberOfFiles:1, 数据类型:“json”, 完成:功能(e,数据){ $.each(data.result.files,函数(索引,文

我正在尝试使用date对象获取报税表。 但我不能和console.log的firebug我看到了你想要使用的值

我试图展示我的形象

我需要获取数据对象名称中返回的值

我的代码(js)

$(函数(){
//"严格使用",;
$('#fileupload')。fileupload({
url:“/resource/upfoto2.ashx”,
maxNumberOfFiles:1,
数据类型:“json”,
完成:功能(e,数据){
$.each(data.result.files,函数(索引,文件){
$('

').text(file.name).appendTo('#files'); }); }, progressall:功能(e、数据){ var progress=parseInt(data.loaded/data.total*100,10); $('#progress.progress bar').css( “宽度”, 进度+“%” ); } }).bind('fileuploadadd',函数(e,data){$(“#progress”).show();})//2 .bind('fileuploadsubmit',函数(e,data){}//3 .bind('fileuploadsend',函数(e,data){}//5 .bind('fileuploaddone',函数(e,data){}//8 .bind('fileuploadfail',函数(e,数据){}) .bind('fileuploadalways',函数(e,data){}//9 .bind('fileuploadprogress',函数(e,数据){ 控制台日志(数据); })//6 .bind('fileuploadprogressall',函数(e,data){}//7 .bind('fileuploadstart',函数(e){ })//4 .bind('fileuploadstop',函数(e,数据){ $(“#boxCrop”).load(“/resource/crop.html?r=“+Math.random(2)); })//10-法泽尔终点站 .bind('fileuploadchange',函数(e,data){}//1 .bind('fileuploadpaste',函数(e,数据){}) .bind('fileuploaddrop',函数(e,data){}) .bind('fileuploaddragover',函数(e){}) .bind('fileuploadchunksend',函数(e,data){}) .bind('fileuploadchunkdone',函数(e,数据){}) .bind('fileuploadchunkfail',函数(e,数据){}) .bind('fileuploadchunkalways',函数(e,数据){}).prop('disabled',!$.support.fileInput).parent().addClass($.support.fileInput?未定义:'disabled'); });


根据您发布的代码,问题在于
文件名的大写错误

done: function (e, data) {
    $.each(data.result.files, function (index, file) {
        $('<p/>').text(file.Name).appendTo('#files');
    });
},
done:函数(e,数据){
$.each(data.result.files,函数(索引,文件){
$('

').text(file.Name).appendTo('#files'); }); },

另外,将空函数绑定到处理程序就像根本不绑定它们一样,因此我建议您去掉所有您实际上不使用/不会使用的额外处理程序。这使您的代码看起来像这样:

$(function () {
    //'use strict';
    $('#fileupload').fileupload({
            url: '/resource/upfoto2.ashx',
            maxNumberOfFiles: 1,
            dataType: 'json',
            done: function (e, data) {
                $.each(data.result.files, function (index, file) {
                    $('<p/>').text(file.Name).appendTo('#files');
                });
            },
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                    'width',
                    progress + '%'
                );
            }
        }).bind('fileuploadadd', function (e, data) {
            $("#progress").show();
        })
        .bind('fileuploadprogress', function (e, data) {
            console.log(data);
        })
        .bind('fileuploadstop', function (e, data) {
            $("#boxCrop").load("/resource/crop.html?r=" + Math.random(2));
        })
        .prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
});
$(函数(){
//"严格使用",;
$('#fileupload')。fileupload({
url:“/resource/upfoto2.ashx”,
maxNumberOfFiles:1,
数据类型:“json”,
完成:功能(e,数据){
$.each(data.result.files,函数(索引,文件){
$('

').text(file.Name).appendTo('#files'); }); }, progressall:功能(e、数据){ var progress=parseInt(data.loaded/data.total*100,10); $('#progress.progress bar').css( “宽度”, 进度+“%” ); } }).bind('fileuploadadd',函数(e,数据){ $(“#进度”).show(); }) .bind('fileuploadprogress',函数(e,数据){ 控制台日志(数据); }) .bind('fileuploadstop',函数(e,数据){ $(“#boxCrop”).load(“/resource/crop.html?r=“+Math.random(2)); }) .prop('disabled',!$.support.fileInput).parent().addClass($.support.fileInput?未定义:'disabled'); });


显示失败的代码如何?您的问题是什么?我需要获取名称Images中输入的值。在您的问题中,您已声明:“…尝试使用date对象获取返回值”。您最后的评论与此有何关联?显示您遇到麻烦的代码,并解释您希望代码做什么,以及它能做什么。@Teemu我怀疑是谷歌翻译还是糟糕的英语。我提交了一份编辑建议,试图澄清他的问题。
$(function () {
    //'use strict';
    $('#fileupload').fileupload({
            url: '/resource/upfoto2.ashx',
            maxNumberOfFiles: 1,
            dataType: 'json',
            done: function (e, data) {
                $.each(data.result.files, function (index, file) {
                    $('<p/>').text(file.Name).appendTo('#files');
                });
            },
            progressall: function (e, data) {
                var progress = parseInt(data.loaded / data.total * 100, 10);
                $('#progress .progress-bar').css(
                    'width',
                    progress + '%'
                );
            }
        }).bind('fileuploadadd', function (e, data) {
            $("#progress").show();
        })
        .bind('fileuploadprogress', function (e, data) {
            console.log(data);
        })
        .bind('fileuploadstop', function (e, data) {
            $("#boxCrop").load("/resource/crop.html?r=" + Math.random(2));
        })
        .prop('disabled', !$.support.fileInput).parent().addClass($.support.fileInput ? undefined : 'disabled');
});