0

如何使用 html 表单中的操作,以便我可以发送表单中的所有数据

我试过$("#formupload").attr('action')似乎不起作用

这是我的代码:

$(".clickupload").click(function () {
        $("#dialog-form").dialog("open");
    });
    $("#dialog-form").dialog({
        autoOpen: false,
        closeOnEscape: true,
        title: "Upload Picture",
        width: 400,
        height: 300,
        modal: true,
        buttons: {
            Cancel: function () {
                $(this).dialog("close");
            },
            Upload: function () {
                $(document).ready(function () {

                    $("#formupload").attr('action');
                });

    }

        }
    });



<div id="dialog-form">
<form id="formupload" action="ProfileImages/FileUpload.php" method="POST" enctype="multipart/form-data">
<input  type="file" name="uploadProfilePicture"/>
</form>
</div>
4

3 回答 3

1

你是说最终$("#formupload").sumbit();?你正在做的是读取属性然后什么都不做?

于 2013-04-11T18:38:37.993 回答
0

bweobi 说了什么,并最终将所有 jQuery 初始化内容放在文档上,以确保在将事件处理程序添加到其元素之前,该文档已全部初始化:

(function($) { // Allows you to create variables locally so
               // there are no conflict with other stuffs.

    $(document).ready(function() {

        // You can name jQuery variables with a dollar so you can easily make
        // the difference betwen jQuery and non-jquery objects.
        $dialogForm = $('#dialog-form'); // Half queries, double speed.

        $(".clickupload").click(function () {
            $dialogForm.dialog("open");
        });

        $dialogForm..dialog({
            autoOpen:      false,
            closeOnEscape: true,
            title:         "Upload Picture",
            width:         400,
            height:        300,
            modal:         true,
            buttons: {
                Cancel: function () {
                    $(this).dialog("close");
                },
                Upload: function () {
                    $("#formupload").submit();
                }
            }
        });

    });

})(jQuery); // Alows you not to use $ in global scope in case
            // you use multiple libraries that use the $.
于 2013-04-11T18:47:04.257 回答
0

尝试简单$("#formupload").submit()

于 2013-04-11T18:39:45.350 回答