Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Mozilla时,Ajax表单没有通过_Javascript_Jquery_Firefox_Bootstrap 4_Ajaxform - Fatal编程技术网

Javascript 使用Mozilla时,Ajax表单没有通过

Javascript 使用Mozilla时,Ajax表单没有通过,javascript,jquery,firefox,bootstrap-4,ajaxform,Javascript,Jquery,Firefox,Bootstrap 4,Ajaxform,当我在表格上时,它说已经提交了,但它没有在我的电子邮件中收到。它与铬合金和MS Edge配合使用效果良好。任何帮助都将不胜感激 我上传了Java的最新版本,但是当我在.html文件中引用新版本时,它会出现一个空白网页。 或者说,它对新版本并不满意。我想这可能是Mozilla的问题,但我不确定 JS文件: jQuery(document).ready(function() { //Captcha $('.captcha-button').click(function() {

当我在表格上时,它说已经提交了,但它没有在我的电子邮件中收到。它与铬合金和MS Edge配合使用效果良好。任何帮助都将不胜感激

我上传了Java的最新版本,但是当我在.html文件中引用新版本时,它会出现一个空白网页。 或者说,它对新版本并不满意。我想这可能是Mozilla的问题,但我不确定

JS文件:

 jQuery(document).ready(function() {

   //Captcha
   $('.captcha-button').click(function() {
     $( ".not-a-robot-text" ).fadeOut( 500 );
     $( ".not-a-robot-icon i" ).delay( 499 ).fadeIn( 500 );
     $( ".captcha-button" ).delay( 1500 ).fadeOut( 0 );
     $( ".button-parent" ).html( '<button style="display:none" class="submit-form button border-radius l=12 text-white background-orange" type="submit">Submit Button</button>' );
     $( ".submit-form.button" ).delay( 1500 ).fadeIn( 0 );   
   });

   $('.ajax-form').each(function(index, element) {
       $(this).submit(function(e) {

           //Stop form submission & check the validation
           e.preventDefault();
           window.error = false;           
           //text, textarea
           $(element).find('.required').each(function() {           
               // Variable declaration               
               var required = $(element).find(this);
               var required_val = $(element).find(this).val();


               // Form field validation 
               if (required_val.length == 0) {
                   window.error = true;
                   $(this).parent().find('.form-error').fadeIn(500);
                   $(element).find('.mail-success').fadeOut(500);
               } else { 
                   $(this).parent().find('.form-error').fadeOut(500);
                   $(element).find('.mail-fail').fadeOut(500);  
               }
           });

           //email
           $(element).find('.email').each(function() {           
               // Variable declaration               
               var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
               var email = $(this).val();   
               // Form field validation 
               if (!filter.test(email)) {
                   window.error = true; 
                   $(this).parent().find('.form-error').fadeIn(500);
                   $(element).find('.mail-success').fadeOut(500);
               } else { 
                   $(this).parent().find('.form-error').fadeOut(500);
                   $(element).find('.mail-fail').fadeOut(500);  
               }
           });            

           // If there is no validation error, next to process the mail function
           if (window.error == false) {
                var formObj = $(this);
                var formURL = formObj.attr("action");
                var formData = new FormData(this);
                $.ajax ({
                    url: 'resp-csa2.php',
                    type: 'POST',
                    data:  formData,
                    mimeType:"multipart/form-data",
                    contentType: false,
                    cache: false,
                    processData:false,
                success: function(data, textStatus, jqXHR)
                {
                    //If the email is sent successfully, reset form
                    $(element).each(function() {
                       this.reset();
                    });
                    //Display the success message
                    $(element).find('.mail-success').fadeIn(500);
                },
                error: function(jqXHR, textStatus, errorThrown) 
                {
                    //Display the error message
                    $(element).find('.mail-success').fadeOut(500);
                    $(element).find('.mail-fail').fadeIn(500);
                }          
                });
                e.preventDefault(); //Prevent Default action. 
                e.unbind();
            }   
       });
   });
});


jQuery(文档).ready(函数(){
//验证码
$('.captcha按钮')。单击(函数(){
$(“.not-a-robot-text”).fadeOut(500);
$(“.not-a-robot-icon i”).delay(499)。fadeIn(500);
$(“.captcha按钮”)。延迟(1500)。淡出(0);
$(“.button parent”).html('Submit button');
$(“.submit form.button”).delay(1500.fadeIn(0);
});
$('.ajax form')。每个(函数(索引、元素){
$(此).submit(函数(e){
//停止表单提交并检查验证
e、 预防默认值();
window.error=false;
//文本,文本区
$(元素).find('.required').each(函数(){
//变量声明
所需变量=$(元素)。查找(此);
var required_val=$(元素).find(this.val();
//表单字段验证
如果需要(值长度=0){
window.error=true;
$(this.parent().find('.form error').fadeIn(500);
$(元素).find('.mail success').fadeOut(500);
}否则{
$(this.parent().find('.form error').fadeOut(500);
$(元素).find('.mail fail').fadeOut(500);
}
});
//电子邮件
$(元素).find('.email').each(函数(){
//变量声明
var filter=/^([\w-\.]+)@(\[[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[124;([\ w-]+\.)+)([a-zA-Z]{2,4}.[0-9]{1,3})(\]?)$/;
var email=$(this.val();
//表单字段验证
如果(!filter.test(电子邮件)){
window.error=true;
$(this.parent().find('.form error').fadeIn(500);
$(元素).find('.mail success').fadeOut(500);
}否则{
$(this.parent().find('.form error').fadeOut(500);
$(元素).find('.mail fail').fadeOut(500);
}
});            
//如果没有验证错误,请单击“处理邮件”功能旁边的
如果(window.error==false){
var formObj=$(此项);
var formURL=formObj.attr(“操作”);
var formData=新formData(本);
$.ajax({
url:'resp-csa2.php',
键入:“POST”,
数据:formData,
mimeType:“多部分/表单数据”,
contentType:false,
cache:false,
processData:false,
成功:函数(数据、文本状态、jqXHR)
{
//如果电子邮件发送成功,请重置表单
$(元素)。每个(函数(){
这是reset();
});
//显示成功消息
$(元素).find('.mail success').fadeIn(500);
},
错误:函数(jqXHR、textStatus、errorshown)
{
//显示错误消息
$(元素).find('.mail success').fadeOut(500);
$(元素).find('.mail fail').fadeIn(500);
}          
});
e、 preventDefault();//防止默认操作。
e、 解除绑定();
}   
});
});
});

检查Firefox开发工具中的网络选项卡。它是否说明了您提出的AJAX请求?没有显示“红色”,但我不确定我在寻找什么。当我提交表单时,Web开发者网络部分显示POST和文件resp-csa2.php,原因显示xhrSide问题;你想用这个做什么
var required_val=$(元素).find(this.val()?我怀疑
窗口。错误
。也许这是Mozilla的内置属性。为什么要用它来代替局部变量?