jeudi 26 novembre 2015

jQuery Ajax: Variable as Header key

So currently im working with emberjs and i try to set the header of a request this way with variables:

 Ember.$.ajax({
            type: "GET",
            url: this.requestEndpoint,
            headers: {`${headerName}`: headerValue}
        })

But the problem is that in headers: {`${headerName}`: headerValue} the ` is a unexpected token. Do you have an idea to solve that problem?

Edit: Just to make sure headerName and headerValue are the variables.




Aucun commentaire:

Enregistrer un commentaire