From 01d5454d9dd3b0781cfc52a86fa09db0da46aab7 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Fri, 14 Sep 2012 12:51:56 -0700 Subject: [PATCH] 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() {}); } } --- forcetk.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forcetk.js b/forcetk.js index f754db9..762324d 100644 --- a/forcetk.js +++ b/forcetk.js @@ -147,6 +147,9 @@ if (forcetk.Client === undefined) { */ forcetk.Client.prototype.ajax = function(path, callback, error, method, payload, retry) { var that = this; + if (path.substring(0, 14) != '/services/data') { + path = '/services/data' + path; + } var url = this.instanceUrl + '/services/data' + path; $j.ajax({