I'm trying to make an Ajax call from my client like that:
$.ajax({
url: '/item/' + id + '/action?parameter=' + parameter,
method: 'GET',
success: function(data) {
.....
}
});
and the error I'm getting is:
500 (Internal Server Error) (from the Azure server (c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+""); (highlight)
The rest of the site is working well, only the ajax call returs the error (tried also with POST)
In my server, I've done few attempts:
1)
cors = require('cors'),
path = require('path');
var app = express();
app.use(cors());
2)
exports.action= function(req, res) {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Headers", "X-Requested-With");
But still getting the error