Sulzer: So h3 will have the id, type, exp_month and exp_year
Szychowski: So do you not know how to make elements with jquery?
Goldberger: Dont go down that route
Szychowski: Yeah, use a templating engine instead if you can/.
Szychowski: You can do this with jquery but it’s pretty gross.
Kimberlin: Will the template generate the html structure for each of the records in the json decx
Szychowski: That’s what a templating engine dooes.
Szychowski: You feed it a format and your data and it spits out HTML.
Munshi: Szychowski, {“id”:”card_187wcdHV08ug7″,”type”:”Visa”,”cardno”:”**** 4242″,”exp_month”:6,”exp_year”:2019, “fee”: 0.50},{“id”:”card_189KaFH”,”type”:”MasterCard”,”cardno”:”**** 4444″,”exp_month”:5,”exp_year”:2017, “fee”: 0.50};
Goldberger: Https://jsfiddle.net/decx/zz6t49kf/3/ here’s the most simple template system you’ll find. but it gives you an idea
Szychowski: I looked at the fiddle, dude.
Voisard: That is what i get back from the jquery ajax
Dipiano: So i need to structure it and style it into the htm
Szychowski: We know exactly what you need to do.
Szychowski: We’re offering solutions.
Goldberger: Eddy: check the fiddle
Szychowski: I don’t know how else to phrase this.
Kleese: Decx, https://jsfiddle.net/zz6t49kf/4/
Goldberger: So add your div to the template
Bedonie: When you click on it it should expand those show https://drive.google.com/open?id=0ByGgvwO76KWTYXFLNXR3Tkw3bGs
Szychowski: Eddy right, he’d not doing it for you.
Szychowski: He’s given you an example. build upon it :
Goldberger: And this template function is just an example too
Goldberger: It’s pretty damn cool and short, but any mature template system will be better
Bhalla: Decx, you have a recommandation?
Goldberger: I like handlebars with jquery
Deblauw: Your example is good but i dont like it because it has “script”
Goldberger: Doesnt matter where you get the template html string from
Szychowski: If you already have underscore in your project you could use that, too.
Szychowski: Aaand it’s quiet again
Grewal: Doesnt work for me decx
Szychowski: Show us what you tried.
Goldberger: You dont declare a function in another function
Szychowski: Also, you’re initializing the accordionbefore you append the elements.
Goldberger: Dont just copy and paste
Corrieri: Uncaught TypeError: data.map is not a function
Szychowski: You’re changing things on us.
Goldberger: Doesnt make sense what you do here
Goldberger: You can create a templaet string like that
Goldberger: But not with accordion and not with the id
Ildefonso: Data is a jquery ajax to a php server which then feed back a json
Walts: Which is shown in the original jsfiddle
Angolo: That template thing wouldnt work
Szychowski: Way fractured : update http://kopy.io/0eth8 with whatever is relevant.
Roedel: They should ne another way
Szychowski: You just aren’t using correctly.
Szychowski: There’s no data var there fwiw.
Szychowski: I think you meant to p*** “d”
Lingo: Szychowski, http://kopy.io/0eth8 line 3
Goldberger: You still init the accordion before it has content
Goldberger: And you still use the function i told you not to use
Szychowski: Audrey then d isn’t what you think it is.
Goldberger: And it’s still inside a function