submit success but upload not work at combine form

前端 未结 6 1030
迷失自我
迷失自我 2021-01-17 18:14

During trying to combine submit and upload in one form, I have a problem in upload but for submit form it\'s no problem.

JQuery + Ajax :

$(\"#oqcsubm         


        
6条回答
  •  臣服心动
    2021-01-17 18:41

    Better is using a simply way, with separate process :

    $("#oqcsubmit").click(function() {
        if($("#oqc").valid()) {
                var params=$("#oqc").serialize();
                    $.ajax({
                        type:"post",
                            url:"doinput.php",
                            data:params,
                            cache :false,
                            async :false,
                            success : function() {
                                $(".dt").val("");
                                    $(".stat").val("");
                                    return this;
                                    },
                            error : function() {
                                alert("Data failed to input.");
                                    }
                            });
                     return false;
                     }
         });
    
    
    Upload File:

    both can works normally,the best way is do not do the complicated way if the easy one can be done.

提交回复
热议问题