javascript - Populate numbered buttons using jquery's $.post() -


i'm using jquery $.post() call data. works fine. question how can create buttons number of returned data?

  var = 0;   $.post('getfruits.php',         {           category:fruits         },       function(data){         i++;         += '<button type="button" class="small">i</button>';    }); 

php:

$data['pages'] = $pgs; echo json_encode($data); 

do

  $.post('getfruits.php',             {                 category: fruits             },     function (data) {          var buttons="";          returned_data = json.parse(data);         for(i = 0; <= returned_data.pages; i++){             buttons +='<button type="button" class="small">button number '+i+'</button>';         }        }); 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -