By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

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

P: 1
Expand|Select|Wrap|Line Numbers
  1. var chapter_card_common_id = new Array();
  2.     var no_of_questions = new Array();
  3.     var took_the_test = new Array();
  4.     var times_reviewed = new Array();
  5.     var speed = new Array();
  6.     var accuracy = new Array();
  7.     var unattempted = new Array();
  8.     var correct = new Array();
  9.     var wrong = new Array();
  10.     var marked = new Array();
  11.     var notseen = new Array();
  12.     var user_id = 1;
  13.      //alert("hiiiiiiiiii");
  14.         $.post("fill_cards_php.php",function(data1) 
  15.             {
  16.                         alert(data1.chapter_card_common_id.length);
  17.                         for(var ii = 0 ; ii< data1.chapter_card_common_id.length ; ii++) 
  18.                             {
  19.                         chapter_card_common_id[ii] = data1.chapter_card_common_id[ii];
  20.                         no_of_questions[ii] = data1.no_of_questions[ii];
  21.                         took_the_test[ii] = data1.took_the_test[ii];
  22.                         times_reviewed[ii] = data1.times_reviewed[ii];
  23.                         speed[ii] = data1.speed[ii];
  24.                         accuracy[ii] = data1.accuracy[ii];
  25.                         unattempted[ii] = data1.unattempted[ii];
  26.                         correct[ii] = data1.correct[ii];
  27.                         wrong[ii]=data1.wrong[ii];
  28.                         marked[ii]=data1.marked[ii];
  29.                         notseen[ii]=data1.notseen[ii];
  30.  
  31. }
  32.  
  33.             },'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(variable);
variable->is the variable tat i have set inside ajax request.
Jul 6 '14 #1
Share this Question
Share on Google+
1 Reply


Dormilich
Expert Mod 5K+
P: 8,639
looks like you want to use standard object access here
Jul 6 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.