Example: Javascript » A simple ajax (JSONP) request to the data API using jQuery. var data = { resource_id: '60506bbb-685f-4360-8a8c-30e137ce3615', // the resource id limit: 5, // get 5 results q: 'jones' // query for 'jones' }; $.ajax({ url: 'https://data.virginia.gov/api/3/action/datastore_search', data: data, dataType: 'jsonp', success: function(data) { alert('Total results found: ' + data.result.total) } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter