繁体   English   中英

在Ajax成功计时选择器无效后

[英]after Ajax success timepicker doesn't work

我想要一个24小时制的时间选择器。 我的jQuery代码:

success: function(data) { 
        table_plannings_type.rows().remove().draw(); 

        $.each(data, function(index, value) {
                  somme_lundi = ( new Date("1970-1-1 " + value.new_lundi_heure_a) - new Date("1970-1-1 " + value.new_lundi_heure_de) ) / 1000 / 60 / 60;
                  somme_mardi = ( new Date("1970-1-1 " + value.new_mardi_heure_a) - new Date("1970-1-1 " + value.new_mardi_heure_de) ) / 1000 / 60 / 60;
                  somme_mercredi = ( new Date("1970-1-1 " + value.new_mercredi_heure_a) - new Date("1970-1-1 " + value.new_mercredi_heure_de) ) / 1000 / 60 / 60;
                  somme_jeudi = ( new Date("1970-1-1 " + value.new_jeudi_heure_a) - new Date("1970-1-1 " + value.new_jeudi_heure_de) ) / 1000 / 60 / 60;
                  somme_vendredi = ( new Date("1970-1-1 " + value.new_vendredi_heure_a) - new Date("1970-1-1 " + value.new_vendredi_heure_de) ) / 1000 / 60 / 60;
                  somme_samedi = ( new Date("1970-1-1 " + value.new_samedi_heure_a) - new Date("1970-1-1 " + value.new_samedi_heure_de) ) / 1000 / 60 / 60;
                  somme_dimanche = ( new Date("1970-1-1 " + value.new_dimanche_heure_a) - new Date("1970-1-1 " + value.new_dimanche_heure_de) ) / 1000 / 60 / 60;

                  table_plannings_type.row.add(["<td hidden></td>",
                    "<td class='text-center text_vertical td_profil_total'>" +value.libelle+ " <a class='action_supprimer_profil' hidden style='color:red ;' title='Supprimer'> <i class='fa fa-times-circle' style='font-size: 12px;'></i></a><input type='hidden' name='hidden_profil_total[]' class='hidden_profil_total' value='"+value.total+"'><input type='hidden' name='hidden_id_profil[]' id='hidden_id_profil' value='"+value.id_profil+"'></td>",
                });

              }

成功获取动态内容后,您必须重新启动时间选择器

success: function(data) { 
    table_plannings_type.rows().remove().draw(); 

    $.each(data, function(index, value) {
              somme_lundi = ( new Date("1970-1-1 " + value.new_lundi_heure_a) - new Date("1970-1-1 " + value.new_lundi_heure_de) ) / 1000 / 60 / 60;
              somme_mardi = ( new Date("1970-1-1 " + value.new_mardi_heure_a) - new Date("1970-1-1 " + value.new_mardi_heure_de) ) / 1000 / 60 / 60;
              somme_mercredi = ( new Date("1970-1-1 " + value.new_mercredi_heure_a) - new Date("1970-1-1 " + value.new_mercredi_heure_de) ) / 1000 / 60 / 60;
              somme_jeudi = ( new Date("1970-1-1 " + value.new_jeudi_heure_a) - new Date("1970-1-1 " + value.new_jeudi_heure_de) ) / 1000 / 60 / 60;
              somme_vendredi = ( new Date("1970-1-1 " + value.new_vendredi_heure_a) - new Date("1970-1-1 " + value.new_vendredi_heure_de) ) / 1000 / 60 / 60;
              somme_samedi = ( new Date("1970-1-1 " + value.new_samedi_heure_a) - new Date("1970-1-1 " + value.new_samedi_heure_de) ) / 1000 / 60 / 60;
              somme_dimanche = ( new Date("1970-1-1 " + value.new_dimanche_heure_a) - new Date("1970-1-1 " + value.new_dimanche_heure_de) ) / 1000 / 60 / 60;

              table_plannings_type.row.add(["<td hidden></td>",
                "<td class='text-center text_vertical td_profil_total'>" +value.libelle+ " <a class='action_supprimer_profil' hidden style='color:red ;' title='Supprimer'> <i class='fa fa-times-circle' style='font-size: 12px;'></i></a><input type='hidden' name='hidden_profil_total[]' class='hidden_profil_total' value='"+value.total+"'><input type='hidden' name='hidden_id_profil[]' id='hidden_id_profil' value='"+value.id_profil+"'></td>",
    });
    $('.someclass').timepicker();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM