I need to append values that i have got from ajax request into html elements

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sushantsumbare
    New Member
    • Jul 2014
    • 1

    #1

    I need to append values that i have got from ajax request into html elements

    Code:
    var chapter_card_common_id = new Array();
        var no_of_questions = new Array();
        var took_the_test = new Array();
        var times_reviewed = new Array();
        var speed = new Array();
    	var accuracy = new Array();
    	var unattempted = new Array();
        var correct = new Array();
    	var wrong = new Array();
        var marked = new Array();
        var notseen = new Array();
    	var user_id = 1;
         //alert("hiiiiiiiiii");
    		$.post("fill_cards_php.php",function(data1) 
    			{
    						alert(data1.chapter_card_common_id.length);
    						for(var ii = 0 ; ii< data1.chapter_card_common_id.length ; ii++) 
    							{
    						chapter_card_common_id[ii] = data1.chapter_card_common_id[ii];
    						no_of_questions[ii] = data1.no_of_questions[ii];
    						took_the_test[ii] = data1.took_the_test[ii];
    						times_reviewed[ii] = data1.times_reviewed[ii];
    						speed[ii] = data1.speed[ii];
    						accuracy[ii] = data1.accuracy[ii];
    						unattempted[ii] = data1.unattempted[ii];
    						correct[ii] = data1.correct[ii];
    						wrong[ii]=data1.wrong[ii];
    						marked[ii]=data1.marked[ii];
    						notseen[ii]=data1.notseen[ii];
    				
    }
    								
                },'json');

    Above is the code snippet i am using in my code.
    I have got data from ajax request in variable data1.
    i have used json.now i need to append those values to html elements like
    $('#1_front #times_reviewed ').text(variabl e);
    variable->is the variable tat i have set inside ajax request.
    Last edited by Dormilich; Jul 6 '14, 07:31 AM. Reason: please use code tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    looks like you want to use standard object access here …

    Comment

    Working...