Skip to content

Commit 01d5454

Browse files
committed
Make ajax method compatible with nextRecordsUrl
The ajax call no longer prepends /services/data to paths that already start with it. This allows the ajax method to be used with the URL contained in the nextRecordsUrl attribute of the result object passed to the query method's success callback. Here's an example: forcetkClient.query('SELECT Id, Name FROM Account', handleResult, function() {}); function handleResult(result) { // do something with the result if (! result.done) { forcetkClient.ajax(result.nextRecordsUrl, handleResult, function() {}); } }
1 parent 026cfcc commit 01d5454

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

forcetk.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ if (forcetk.Client === undefined) {
147147
*/
148148
forcetk.Client.prototype.ajax = function(path, callback, error, method, payload, retry) {
149149
var that = this;
150+
if (path.substring(0, 14) != '/services/data') {
151+
path = '/services/data' + path;
152+
}
150153
var url = this.instanceUrl + '/services/data' + path;
151154

152155
$j.ajax({

0 commit comments

Comments
 (0)