Very simple JSON not working with Google json API
I'm using the below code to load a json feed from google which looks like this:
// [ { "id": "14323395" ,"t" : "RBS" ,"e" : "LON" ,"l" : "43.68" ,"l_cur" : "GBX43.68" ,"ltt":"8:41AM BST" ,"lt" : "May 21, 8:41AM BST" ,"c" : "-1.14" ,"cp" : "-2.54" ,"ccol" : "chr" } ]
Now this doesn't work because of the // and the square brackets [ ] - if I remove these it works great, but obviously can't change this.
Any ideas how to get this working in jQuery?
- <script type="text/javascript">
- $(document).ready(function() {
- $.ajax({
- dataType: 'json',
- success: function(data) {
- // do something
- $('.result').html(data.id);
- },
- url: 'http://finance.google.com/finance/info?client=ig&q=ftse:rbs''
- });
- });