Page History
...
Code Block | ||
---|---|---|
| ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script> <script src="httphttps://s3.amazonaws.com/filestore.rescuegroups.org/scripts/noncvs/jquery-json.js" type="text/javascript"></script> <script> var thing = {"apikey":"****","objectType":"animals","objectAction":"publicSearch","search":{"calcFoundRows":"Yes","resultStart":0,"resultLimit":0,"fields":["animalName"],"filters":[{"fieldName":"animalStatus","operation":"equals","criteria":"Adopted"},{"fieldName":"animalOrgID","operation":"equals","criteria":"****"}]}}; var encoded = $.toJSON(thing) $.ajax({ url: "https://api.rescuegroups.org/http/json/?data=" + encoded, dataType: "jsonp", success: function(data) { if (data.foundRows) document.getElementById('adoptedPetsCount').innerHTML = data.foundRows; }, error: function(xhr, status, error) { console.log('error'); } }); </script> |
...
The example above uses the JavaScript code "document.getElementById('adoptedPetsCount').innerHTML" to change the content of the adoptedPetsCount element to the value that it received from the HTTP API.
Overview
Content Tools