# Ember-Data and CORS

**URL:** <https://discuss.emberjs.com/t/ember-data-and-cors/3690>\
**Category:** Ember Data\
**Created:** [December 27, 2013, 11:23pm UTC](https://discuss.emberjs.com/t/ember-data-and-cors/3690 "2013-12-27T23:23:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![davepreston](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/davepreston/32/15112_2.png) [@davepreston](https://discuss.emberjs.com/u/davepreston)\
**Post date:** [January 21, 2014, 10:07pm UTC](https://discuss.emberjs.com/t/ember-data-and-cors/3690/4 "2014-01-21T22:07:29Z")

</div>

> [@mixonic](#):
>
> ```
> ajax: function(url, method, hash) {
> hash.crossDomain = true;
> hash.xhrFields = {withCredentials: true};
> return this._super(url, method, hash);
> }
> 
> ```

@mixonic You saved me so much time. (I wish I had found this 4 hours ago :)).

One modification I had to make was to handle the case where hash is undefined.

```
 ajax: function(url, method, hash) {
    hash = hash || {}; // hash may be undefined
    hash.crossDomain = true;
    hash.xhrFields = {withCredentials: true};
    return this._super(url, method, hash);
  }

```

Thanks again!

---

_[View the full topic](https://discuss.emberjs.com/t/ember-data-and-cors/3690)._
