Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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 在下一个函数中添加到_Javascript_Ajax_Jquery - Fatal编程技术网

Javascript 在下一个函数中添加到

Javascript 在下一个函数中添加到,javascript,ajax,jquery,Javascript,Ajax,Jquery,我有下一个功能 $(".formact").validate({ submitHandler: function (form) { $.ajax({ type: "POST", url: "act_cant.php", data: $(".formact").serialize(), beforeSend: function() { $("#shopingcountcont").h

我有下一个功能

$(".formact").validate({
submitHandler:  function (form) {
$.ajax({
    type: "POST",
    url: "act_cant.php",
    data: $(".formact").serialize(),

    beforeSend: function() {                                
        $("#shopingcountcont").html("<img src='../loading_core/loading animated/loader.gif'class='clock' border='0' />");                                       
    }, 

    success: function(result) {                     
        $("#shopingcountcont").html(result); 

    }

}); 
}
}); 
$(“.formact”).validate({
submitHandler:函数(表单){
$.ajax({
类型:“POST”,
url:“act_cant.php”,
数据:$(“.formact”).serialize(),
beforeSend:function(){
$(“#shopingcountcont”).html(“”);
}, 
成功:函数(结果){
$(“#shopingcountcont”).html(结果);
}
}); 
}
}); 
但在我的页面中,我在同一个类中有一个多个表单,它们的表单在一个小窗口中

问题是,只有一个表单运行一个函数,而其他表单则不是,我在函数中有每个表单,但我不知道如何运行。

试试看

 $(".formact").each(function(){

    $(this).validate({
    submitHandler:  function (form) {
    $.ajax({
        type: "POST",
        url: "act_cant.php",
        data: $(this).serialize(),

        beforeSend: function() {                                
            $("#shopingcountcont").html("<img src='../loading_core/loading animated/loader.gif'class='clock' border='0' />");                                       
        }, 

        success: function(result) {                     
            $("#shopingcountcont").html(result); 

        }

    }); 
    }
    }); 
});
$(“.formact”)。每个(函数(){
$(此)。验证({
submitHandler:函数(表单){
$.ajax({
类型:“POST”,
url:“act_cant.php”,
数据:$(this).serialize(),
beforeSend:function(){
$(“#shopingcountcont”).html(“”);
}, 
成功:函数(结果){
$(“#shopingcountcont”).html(结果);
}
}); 
}
}); 
});

什么是
口腔
?-谷歌搜索它给了我很多漂亮的女人,这很好。你想做什么?你不能在表单中包含表单,这是无效的html,以防万一,这就是问题所在。我试图让函数在类为的页面中重复的所有表单中生效。formact@limelights我也得到了美女:)但我也得到了一个从西班牙语到英语的翻译网站的链接,该网站的意思可能是“loop”