Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the data from API and put into tha table (Jquery)
    primarykey
    data
    text
    <p>Trying to store all the information that getting from JSONP in the table. Have done the test with 'alert' to make sure that there are more info that only one line and can see that there are more info that one. But when run it, in the table I can see title row and first row. Can somebody correct my error?</p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt; &lt;/script&gt; &lt;script&gt; jQuery(document).ready(function($) { $.ajax({ url : "http://api.example.com/v1/deal/hotel?apikey=xxx&amp;format=JSONP", dataType : "jsonp", success : function(parsed_json) { $.each(parsed_json.Result, function( index, value ) { alert( index + ": " + value.StarRating + " , "+ value.Url); }); var from = parsed_json['Result'][0]['StartDate']; document.getElementById("from").innerHTML = from; var from = parsed_json['Result'][0]['StartDate']; document.getElementById("from").innerHTML = from; var to = parsed_json['Result'][0]['EndDate']; document.getElementById("to").innerHTML = to; var nights = parsed_json['Result'][0]['NightDuration']; document.getElementById("nights").innerHTML = nights; var currency = parsed_json['Result'][0]['CurrencyCode']; document.getElementById("currency").innerHTML = currency; var price = parsed_json['Result'][0]['Price']; document.getElementById("price").innerHTML = price; var link = parsed_json['Result'][0]['Url']; document.getElementById("link").innerHTML = link; //how to represent enlaces var city = parsed_json['Result'][0]['City']; document.getElementById("city").innerHTML = city; var country = parsed_json['Result'][0]['CountryCode']; document.getElementById("country").innerHTML = country; var stars = parsed_json['Result'][0]['StarRating']; document.getElementById("stars").innerHTML = stars; } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;table id="t"&gt; &lt;tr&gt; &lt;th&gt;Start date&lt;/th&gt; &lt;th&gt;End date&lt;/th&gt; &lt;th&gt;Nights&lt;/th&gt; &lt;th&gt;Currency&lt;/th&gt; &lt;th&gt;Price&lt;/th&gt; &lt;th&gt;Link&lt;/th&gt; &lt;th&gt;City&lt;/th&gt; &lt;th&gt;Country Code&lt;/th&gt; &lt;th&gt;Star Rating&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="from"&gt;&lt;/td&gt; &lt;td id="to"&gt;&lt;/td&gt; &lt;td id="nights"&gt;&lt;/td&gt; &lt;td id="currency"&gt;&lt;/td&gt; &lt;td id="price"&gt;&lt;/td&gt; &lt;td id="link"&gt;&lt;/td&gt; &lt;td id="city"&gt;&lt;/td&gt; &lt;td id="country"&gt;&lt;/td&gt; &lt;td id="stars"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The result of the Ajax callback is:</p> <blockquote> <p>callback({"Errors":[],"Result":[{"FoundDate":"2013-12-04T16:11:36-08:00","CurrencyCode":"USD","NightDuration":"2.0","EndDate":"12/08/2013","Headline":"Cairo 5 Star Hotel, $36/night","IsWeekendStay":"true","Price":"36.0","StartDate":"12/06/2013","Url":"http&zwj;://www.example.com/hotel/...&amp;startDate=12/06/2013&amp;endDate=12/08/2013&amp;bid=0&amp;sid=0","City":"Cairo","CountryCode":"EG","NeighborhoodLatitude":"30.0152","NeighborhoodLongitude":"31.1756","Neighborhood":"Cairo West - Giza","StarRating":"5.0","StateCode":"EG"},{"FoundDate":"2013-12-04T14:51:44-08:00", </p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload