1

我用谷歌搜索了很多,但找不到对 Multipart formdata enctype 表单进行 ajax 发布请求的方法。有人可以帮忙吗

4

1 回答 1

-1

查看 dojo.xhr 文档中的示例 1:http: //dojotoolkit.org/reference-guide/1.8/dojo/xhr.html

调整/缩短的版本:

<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>
于 2013-01-22T13:32:17.203 回答