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
Post a Comment