javascript - How to loop sql data into array and adding keys? -


this question has answer here:

i know how loop of sql datas (that parsed json table) array, adding key each of them.

i know how can loop of data simple string :

var dbstring =""; for(i = 0; < result.response.length; i++)  {     dbstring += result.response[i].names; } 

this

var dbstring = "james michael alfred...."; 

but how can make :

var dbstring = {"james":1, "michael":2, "alfred":3, .....} 

thanks.

it's unique demand organise list of names want, here is:

var dbstring = {}; var names = result.response; for(var = 0; < names.length; i++){     dbstring[names[i]] = + 1; } 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -