问题
I googled a lot but could not find a way to do ajax post request for Multipart formdata enctype form .Can anybody help
回答1:
Check out Example 1 in the dojo.xhr documentation: http://dojotoolkit.org/reference-guide/1.8/dojo/xhr.html
A tweaked/shortened version:
<form data-dojo-type="dijit/form/Form" id="myForm" data-dojo-id="myForm"
encType="multipart/form-data" action="" method="">
<input data-dojo-type="dijit/form/ValidationTextBox"
type="text"
id="name"
name="name" />
<div data-dojo-type="dijit/form/Button">
Submit
<script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
dojo.xhrPost({
// The target URL on your webserver:
url: "#",
// The form node, which contains the
// to be transferred form elements:
form: "myForm",
// Event handler on successful call:
load: function(response, ioArgs){
// do something
}
});
</script>
</div>
</form>
来源:https://stackoverflow.com/questions/14459618/multipart-form-data-ajax-request-in-dojo