-1

私は通知システムに取り組んでおり、クラスを削除したり、ajax の成功で html() と append() 以外のことをしたりするのに問題があります。ここに私のコードがあります:

    setInterval(function (){
    $(".notificare_caseta").each(function(){
        var id=$(this).attr("record");
        $.ajax({
            url : "../template/functions/notificari.php?nr="+id,                          
            contentType: "application/json; charset=utf-8",
            dataType:"JSON",                   
            success : function(data) {  
                $(".notificari_zona"+id).html(data.notif);
                if(data.note>0){
                    $(".notificari_note"+id).html(data.note);
                }else{
                    $(".notificari_note"+id).addClass('nu_arata');
                    $(".notificari_note"+id).prev().removeClass("atentionare");
                    $(".notificari_note"+id).next().addClass("nu_arata");
                }
            }
        });                 
    });

    $("#data").load("../template/functions/data.php");

}, 2000);

誰でも私を助けることができますか?next、prev、removeclass、addclass 関数が機能しない。ありがとう

4

1 に答える 1

0

データを送信して戻す機能を書き直しました。

setInterval(function (){
    var ids = [];
    $(".notificare_caseta").each(function(){
        ids.push($(this).attr("record"));
    });
    $.ajax({
        url : "notificari.php",
        data : {"nr":ids},
        dataType:"JSON",
        success : function(data) {  
            //here you should get the all data togther for ex [{"notif":1,"note":1},{"notif":2,"note":2},{"notif":3,"note":3}]
            $.each(data,function(i,x){
                $(".notificari_zona"+ids[x]).html(i.notif);
                if(i.note>0){
                    $(".notificari_note"+ids[x]).html(i.note);
                }else{
                    modify(".notificari_note"+ids[x]);
                }
            })
        }
    });                 


    // $("#data").load("../template/functions/data.php");

}, 10000);
于 2013-04-20T16:05:20.207 に答える