我正在尝试通过 jquery ui 模态表单上传图像..
可能吗?我在如何从模态中获取值时遇到问题..
我一直在网上搜索,但没有明确的答案..
有人知道吗?
这是我的模态表单的javascript代码:
$("#dialog").dialog({
modal: true,
resizable: false,
width: 400,
position: "center",
buttons: {
"Upload": function() {
var pos= $("#pos input:radio:checked").val();
// i still don't know how to get the value for the image uploaded
$( this ).dialog( "close" );
},
"Cancel": function() { $( this ).dialog( "close" ); }
}
});
});
这是我的模态形式:
<div id='dialog' title='ADD IMAGE' class='ui-dialog-content ui-widget-content'>
<form id='myform' method='POST' enctype='multipart/form-data'>
<fieldset>
<div id='pos'>
<p class='applyimage'>Where do you want to apply a background image?</p>
<p class='applyimage'><input type='radio' class='position' name='position' id='header' value='header' checked='checked'/> <label for='header'>Header</label>
<input type='radio' class='position' name='position' id='body' value='body'/> <label for='body'>Body</label>
<input type='radio' class='position' name='position' id='footer' value='footer'/> <label for='footer'>Footer</label></p>
<p class='applyimage'><input type='file' name='data[Image][fileName]' id='imgup'/></p>
</div>
</fieldset>
</form>
</div>