Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.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
jqueryui-如何提交ajax对话框?_Ajax_Node.js_Jquery Ui - Fatal编程技术网

jqueryui-如何提交ajax对话框?

jqueryui-如何提交ajax对话框?,ajax,node.js,jquery-ui,Ajax,Node.js,Jquery Ui,我不理解我的代码。我现在正在使用jqueryui对话框,我正在使用server node.js。我从数据库中获取数据。我目前正在使用详图视图创建对话框。查看页面输出与db数据很好,但点击提交不做任何工作为什么 我的错误消息:TypeError:无法读取未定义的属性“name” 我的密码 $("#detail-form").dialog({ autoOpen : false, height : 600, width : 600, modal : true,

我不理解我的代码。我现在正在使用jqueryui对话框,我正在使用server node.js。我从数据库中获取数据。我目前正在使用详图视图创建对话框。查看页面输出与db数据很好,但点击提交不做任何工作为什么

我的错误消息:TypeError:无法读取未定义的属性“name”

我的密码

    $("#detail-form").dialog({

    autoOpen : false,
    height : 600,
    width : 600,
    modal : true,
    buttons:{
        submit:function(data){
            $.ajax({
                url:'/edit',
                dataType:'json',
                type:'POST',
                data: $("#detail-form").serialize(),
                success:function(data){
                    alert('성공');
                    alert('data');
                    //location.href='/';
                },
                error:function(request,status,error){
                    alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
                 }
            });
        }
    }

});
$.ajax({
     url: '/detail/' + id,
     dataType : 'json',
     type: 'GET',
     success:function(data) {
        alert(data);
         $.each(data, function(i, item){
            $("#detail-form").empty();
            var css = $("<link type=\"text/css\" href=\"/main.css\" rel=\"stylesheet\" />" +
                    "<link rel=\"stylesheet\" href=\"/jquery-ui.css\" />");

            var row = $("<form id=\"form\" method=\"post\" enctype=\"multipart/form-data\" action=\"/edit\"><fieldset><legend>view detail</legend><input type=\"hidden\" name=\"file_no\" value=" + item.file_no+ "><table id=\"board_write\" width=500 height=500><colgroup><col style=\"width: 250px\" /><col style=\"width: 710px\" /></colgroup><tbody>"+
                    "<tr><th class=\"lside\">No.</th><td class=\"rside\"><input type=\"text\" class=\"simple-input\" value="+ item.file_no+ " disabled>" + 
                    "</td></tr><p><tr><th class=\"lside\">filename</th><td class=\"rside\"><input type=\"text\" class=\"simple-input\" value="+item.file_name+">" + 
                    "</td></tr><tr><th class=\"lside\">filemodel</th><td class=\"rside\"><a href=\"/download/item.file_model\" class=\"simple-input\">" + item.file_model + 
                    "</td><tr><tr><th class=\"lside\">file</th><td class=\"rside\"><input type=\"file\" name=\"file_model\" id=\"series\" value="+ item.file_model +">" +
                    "</td></tr><tr><th class=\"lside\">filecontent</th><td class=\"rside\"><input type=\"text\" class=\"simple-input\" value="+ item.file_content+"></td></tr></tbody></table>");
            var btn = $("<button id=\"edit\" name=\"save\">Edit</button></fieldset></form>");


            $("#detail-form").append(css);

            $("#detail-form").append(row);
            $("#detail-form").append(btn);
        }); 
        $("#detail-form").dialog("open"); 

     },
         error:function(request,status,error){
        alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
     }
}); 
  }
$(“#详细表格”)。对话框({
自动打开:错误,
身高:600,
宽度:600,
莫代尔:是的,
按钮:{
提交:功能(数据){
$.ajax({
url:“/edit”,
数据类型:'json',
类型:'POST',
数据:$(“#详细信息表单”).serialize(),
成功:功能(数据){
警惕('성공');
警报(“数据”);
//location.href='/';
},
错误:功能(请求、状态、错误){
警报(“代码:“+request.status+”\n“+”消息:“+request.responseText+”\n“+”错误:“+error”);
}
});
}
}
});
$.ajax({
url:'/detail/'+id,
数据类型:“json”,
键入:“GET”,
成功:功能(数据){
警报(数据);
$。每个(数据、功能(i、项){
$(“#明细表”).empty();
var css=$(“”+
"");
变量行=$(“查看详细信息”+
“否”+
“filename”+
“filemodel”+item.file_model+
“文件”+
“文件内容”);
var btn=$(“编辑”);
$(“#详细表格”)。附加(css);
$(“#明细表”)。追加(行);
$(“#详细表格”)。附加(btn);
}); 
$(“#详细表格”)。对话框(“打开”);
},
错误:功能(请求、状态、错误){
警报(“代码:“+request.status+”\n“+”消息:“+request.responseText+”\n“+”错误:“+error”);
}
}); 
}

您是运行此代码时存在
#详细信息表单
,还是只在AJAX调用中添加了此表单?@scimonest当我在对话框中单击“提交”时,会显示此代码,'TypeError:Cannot read property'name'of undefined'printed..btn不工作,因此我在对话框中添加了提交按钮