jeudi 3 décembre 2015

Ember.js 2 Calls to .net API

I am building a SPA ember.js app that will hit a .net API via an ajax call.

ember.js

getData: function(){
  $.ajax({
    type: "POST",
    url: "http://localhost:9001/controller",
    dataType : "json",
    headers: "Access-Control-Allow-Origin",
    contentType: 'application/json; charset=utf-8',
    success : function(data) {
        return data;
    },
    error:function(data){
      alert('test' + data);
    }
  })
}

It returns an error message : SyntaxError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': 'function () { return _emberRuntimeSystemString.fmt(this, arguments); }' is not a valid HTTP header field value.

I have been hammering away at this issue for a few hours now and I just can't seem to get around it. Also very new to ember.js.

If anyone has a better idea of whats going on...




Aucun commentaire:

Enregistrer un commentaire