I have the following js function, I am having a problem where the success callback is never being called. I stepped through the relevant JQuery code in chrome debugger, and it is picking up the header object in the options argument, but not callbacks such as success, done, always, and error. It just skips them, and I have no idea why. I've tried specifying the url as a entry in options, and it is picked up as I would expect.
Forex.getInstrumentList = function(){
var response;
$.ajax("https://api-fxpractice.oanda.com/v1/instruments?accountId=" + Forex.selectedAcct,
{
success: function(data, err, jqXHR){
if(err){
console.log(err);
return;
}
response = data;
},
headers: {
Authorization: "Bearer notMyrealkey345234234wstd3451345"
}
});
return response; //JSON
}
I grabbed the following from the debugger, as you can see, the success function isn't even in the options argument. I have no idea where or how to start fixing this, so any help is appreciated!
url , and options argument values for the $.ajax function
url = "https://api-fxpractice.oanda.com/v1/instruments?accountId=4161836", options = Object {headers: Object}