mercredi 4 avril 2018

jquery formating output on click event

i have this piece of code so when i click button some json array loads using jquery somthing like this

$("#clickmetoload").click(function()
  {
    $('#id').append("<span class=\"id\">"+received.id+"<span  class=\"name\">"+received.name+"</span></span>");
  });

but then my outout is all wrong it outputs like this

1 2 3 admin user1 user2

but i want it to output like this

1 admin 
2 user1
4 user2




Aucun commentaire:

Enregistrer un commentaire