Grow your CSS skills. Land your dream job.

How to incremen the html attribute class using jquery

  • # January 10, 2013 at 4:04 am

    in Zoho Support » Using Zoho Support • 22 hours ago
    How to increment the html attribute class using jquery. i am actually working on a php/ajax data grid. it works on tables and dynamically i am loading rows result from the database. After the user has added rows with results in one table, the user can add new heading and add new rows in new tables. I am using the following code to do this

    var v = jQuery(“#frmSovMca”).validate({
    errorLabelContainer: $(“div.msg-error2″),

    submitHandler: function(form) {
    jQuery(form).ajaxSubmit({
    success: function(response) {

    obj = jQuery.parseJSON(response);

    if (obj.status == ‘< ?php echo OBJECT_STATUS_SUCCESS; ?>‘) {
    $(‘#result3′).html(‘

    Mca Added/Updated Successfully

    ‘);
    setTimeout(“$(‘#result3′).html(”)”, 2000);
    // $(“td.addmca2″+vCounter).html(obj.message);
    vcounter=< ?php $_SESSION; ?>+””;

    if(obj.title==vcounter){
    $(“td.addmca2″).append(obj.message);

    $(“#Gtotal”).html(obj.GrandTotal);
    $(“#Percentage”).html(obj.Percentage);

    }else{
    $(“td.addmca2″).html(obj.message);

    $(“#Gtotal”).html(obj.GrandTotal);
    $(“#Percentage”).html(obj.Percentage);

    }

    } else{
    $(‘div.msg-error2′).html(‘

    ‘+obj.error+’

    ‘);
    setTimeout(“$(‘div.msg-error2′).html(”)”, 2000);
    }

    },
    clearForm: false,
    resetForm: false
    });
    }
    });
    });
    but i cant get the counter variable incremented from php , i need to use it for incrementing the class attribute to insert the new result in new row with the class incremented.

    the php code is here

    $aSovMca = fGetSovMca($vSubID, $sovID, 0, $_SESSION);

    $aSovMca = fGetScheduleX($aSovMca);

    $aSovMca = OBJECT_STATUS_SUCCESS;

    $vGrandTotal = fGetGrandTotal($_SESSION);
    $vPercentage = fGetPercentage($vGrandTotal);
    $aSovMca = $vPercentage;
    $aSovMca = $vGrandTotal;

    echo json_encode($aSovMca);

    function fGetScheduleX($aSovMca) {

    $vList = ‘

    ‘;

    foreach ($aSovMca as $thisVal)
    $vList .= ‘

    ‘;

    $vList .= ‘

    MCA No. MCA Title Source Quote (CAD) Your Quote(CAD)
    ‘ . $thisVal . ‘ ‘ . $thisVal . ‘ ‘ . $thisVal . ‘ Edit | Remove

    ‘;

    return $vList;
    }

    this is the html table in which i am appending the db result

    please help me how can i get the soulution out of it
    please email me the answer at ignitious_php@hotmail.com

    # January 10, 2013 at 4:15 am

    Your code above is all messy the way you inputted it.

    Please create a [Codepen](http://codepen.io) for us to be able to have a look at everything in a clean environment.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".