当前位置: 代码迷 >> ASP.NET >> ajax提交表单的有关问题(挺棘手的)
  详细解决方案

ajax提交表单的有关问题(挺棘手的)

热度:4474   发布时间:2013-02-25 00:00:00.0
ajax提交表单的问题(挺棘手的)
首先:
     1、页面有个表单:
   <form id="form1" action="input.aspx" method="post" enctype="multipart/form-data">
    //里面有多个text,多个file文本框。
    //还有一个按钮
      <input type="submit" id="btnReg" value="注册" onclick="return checkAll()" />
  </form>

   2、还有个提交表单代码:标题一    
$("#tb input").live("change", function () { //动态绑定每个file
                var file = $(this);
                file.attr("name", "fileSrc");
                if (CheckFilePath($(this))) {
                    $('#form1').ajaxSubmit({
                        url: 'input.aspx?action=' + "up",
                        type: "get",
                        success: function (data, status) {
                            if (status == "success") {
                            if (data == "no") {
                            alert("不能上传大于1M的图片");
                            file.parent()("<input type='file' name='file'/>");
                                    return;
                                }
                                msg(file, "ok");
                            }
                        }
                    });
                }
                else {
                    alert("请上传正确的图片");
  相关解决方案