Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($) {
- // Pull 10 Accounts via the REST API
- $.ajax('/services/data/v28.0/query?q=SELECT+Name+FROM+Account+LIMIT+10',
- {
- beforeSend: function(xhr) {
- // Set the OAuth header from the session ID
- xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}');
- xhr.setRequestHeader('batchSize', '5');
- },
- success: function(response) {
- // We got 'em - append our records to the HTML list
- $.each(response.records, function(index, record) {
- $('#accountList').append('<li>'+record.Name+'</li>');
- });
- },
- error: function(jqXHR, textStatus, errorThrown) {
- // Oops - what went wrong?
- alert(jqXHR.status + ': ' + errorThrown);
- }
- }
- );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement