<html><head>
<title>jQuery Table - Alternate Row Color</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript">
</script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"> </script> <script type="text/javascript"> $(document).ready(function() {
$.ajax({ url: "http://ondemand.websol.barchart.com/getQuote.json?apikey=0a742659d63da13d5d76c611fbbe285b&symbols=ZCH16", //dataType: 'jsonp', // Notice! JSONP <-- P (lowercase) success:function(json){ // $.each(json, function (index, element) { // $('#cornId').append($('<td>', { // text: element.name // }, "</td>")); // if (element.name = "Corn") { // $('#cornId').append($('<td>', { // text: element.name // }, "</td>")); // } else if (element.name = "WHEAT") { // $('#wheatId').append($('<td>', { // text: element.name // }, "</td>")); // } else if (element.name = "SOYBEANS") { // $('#soybeansId').append($('<td>', { // text: element.name // }, "</td>")); // }
//}); alert("Success");
// $("table#quotesTable tr:nth-of-type(odd):nth-child(n+2)").addClass("shaded");
}, error:function(){ alert("Error"); } }); });
</script>
</head><table id="quotesTable"> <tbody> <tr class="header"> <th>@C - CORN - CBOT</th> </tr> <tr id="cornId"></tr>
<tr class="header"> <th>@S - SOYBEANS - CBOT</th> </tr> <tr id="soybeansId"></tr>
<tr class="header"> <th>@W - WHEAT - CBOT</th> </tr> <tr id="wheatId"></tr>
</tbody></table></body>
</html>