This repository was archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 172
This repository was archived by the owner on Jan 10, 2024. It is now read-only.
forcetk.Client.prototype.ajax not working . #62
Copy link
Copy link
Closed
Description
I have created a hybrid salesforce app through forceios and I'm able to show all contacts.
But now I want show the Reports so I used REST API, but the method
forcetk.Client.prototype.ajax
is not getting called and there was no error shown in xcode or browser.
I have shared the code with you, Kindly help me out...
function callback(result){
alert("results");
}
function getReports(){
var path = '/v29.0/analytics/reports/00OD0000001ZbP7MAK/instances';
var method = 'POST';
var error = null;
var payload = null;
var retry = null;
alert("1");
forcetk.Client.prototype.ajax = function(path, callback, error, method, payload, retry) {
alert("2");
var that = this;
var url = this.instanceUrl + '/services/data/v29.0/analytics/reports/00OD0000001ZbP7MAK/instances';
alert(url);
return $j.ajax({
type: method || "GET",
async: this.asyncAjax,
url: (this.proxyUrl !== null) ? this.proxyUrl: url,
contentType: method == "DELETE" ? null : 'application/json',
cache: false,
processData: false,
data: payload,
success: callback,
error: (!this.refreshToken || retry ) ? error : function(jqXHR, textStatus, errorThrown) {
alert("error");
if (jqXHR.status === 401) {
that.refreshAccessToken(function(oauthResponse) {
that.setSessionToken(oauthResponse.access_token, null,
oauthResponse.instance_url);
that.ajax(path, callback, error, method, payload, true);
},
error);
} else {
error(jqXHR, textStatus, errorThrown);
}
},
dataType: "json",
beforeSend: function(xhr) {
if (that.proxyUrl !== null) {
xhr.setRequestHeader('SalesforceProxy-Endpoint', url);
}
xhr.setRequestHeader(that.authzHeader, "OAuth " + that.sessionId);
xhr.setRequestHeader('X-User-Agent', 'salesforce-toolkit-rest-javascript/' + that.apiVersion);
}
});
}
} //End of getReports
Metadata
Metadata
Assignees
Labels
No labels