jquery - iron-ajax GET returning bad request -


i'm using polymer starter kit , configured app.js file creates , iron-ajax element , send call server data. here code:

var _ajax = document.createelement('iron-ajax');     _ajax.url = 'url';     _ajax.headers = '{ "authorization": "auth (number)"}';     _ajax.method = 'get';     _ajax.handleas = 'json';     _ajax.debounceduration = 300;     _ajax.auto = true; 

the error returned code tells me "authorization" in headers not passed through, when console log iron-ajax element before request can see "auth" in headers. doing wrong in code? what's right way headers pass server authentification. note: tested server google "advanced rest api" works fine "auth" set in headers. (using slim php rest server)

headers expects object, not json string representing object:

var _ajax = document.createelement('iron-ajax');     _ajax.url = 'url';     _ajax.headers = {"authorization": "auth (number)"};     _ajax.method = 'get';     _ajax.handleas = 'json';     _ajax.debounceduration = 300;     _ajax.auto = true; 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -