Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {"name":"Silver","price":525,"per_month":"20","first_invoice":"20"},
- {"name":"Gold","price":500,"per_month":"50","first_invoice":"0"},
- {"name":"Avion","price":750,"per_month":"10","first_invoice":"10"}
- ]
- //send get request
- $.get(
- url,
- { 'dst': dst, 'price':price },
- function(data) {
- var objects = jQuery.parseJSON(data);
- var items = [];
- jQuery.each(objects, function(){
- console.log(this);
- items.push('<li id="' + this.name + '">' + this.price + '</li>');
- });
- jQuery('<ul/>', {
- 'class': 'my-new-list',
- html: items.join('')
- }).appendTo('#results');
- }
- );
- jQuery('<ul/>', {
- 'class': 'my-new-list',
- html: items.join('')
- }).appendTo(jQuery('body').find('#results'));
- var objects = jQuery.parseJSON(data);
- var items = '';
- jQuery.each(objects, function(){
- items += '<li id="' + this.name + '">' + this.price + '</li>';
- });
- jQuery('<ul/>', {
- 'class': 'my-new-list'
- }).html(items).appendTo('#results');
- //replace the $('iframe') with ID/class selector if possible
- jQuery('iframe').contents().find('#results').append(jQuery('<ul/>', {
- 'class': 'my-new-list'
- }).html(items));
- $('<ul>')
- .addClass('my-new-list')
- .html($.map(objects, function(el) {
- return '<li id="' + el.name + '">' + el.price + '</li>';
- }).join("n"))
- .appendTo('#results');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement