node.js - jquery ui -how to submit ajax dialog? -
i don't understand code..i using jquery ui dialog now,i using server node.js. data db. using detail view making dialog. view page output db data click submit not work why?
my error message:typeerror: cannot read property 'name' of undefined
my code.
$("#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); } }); }
Comments
Post a Comment