Skip to content

Instantly share code, notes, and snippets.

@MichalBryxi
Last active August 29, 2015 13:59
Show Gist options
  • Save MichalBryxi/10741698 to your computer and use it in GitHub Desktop.
Save MichalBryxi/10741698 to your computer and use it in GitHub Desktop.
ic.ajax problem
// This works:
return ic.ajax(url).then(function (response) {});
// This throws following error:
return ic.ajax.request({
type: "PUT",
url: url
}).then(function (response) {});
// TypeError: undefined is not a function
// And this is interesting:
console.log('ic:');
console.log(ic);
console.log('ic.ajax:');
console.log(ic.ajax);
console.log('ic.ajax.request():');
console.log(ic.ajax.request());
// ic:
// Object {ajax: function}
// ic.ajax:
// function ajax(){return ajax.raw.apply(null,arguments).then(function(result){return result.response},null,"ic-ajax: unwrap raw ajax response")}
// ic.ajax.request():
// TypeError: undefined is not a function
// Finally resolved by using .raw()
return ic.ajax.raw({
type: "PUT",
url: url
}).then(function (response) {});
@libbymo
Copy link

libbymo commented Apr 15, 2014

I assume url is defined... stupid question I know...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment