Error when calling node.js from client side using $.ajax -
i'm trying make ajax call client that:
$.ajax({ url: '/item/' + id + '/action?parameter=' + parameter, method: 'get', success: function(data) { ..... } }); and error i'm getting is:
500 (internal server error) (from azure server (c["x-requested-with"]="xmlhttprequest");for(e in c)void 0!==c[e]&&f.setrequestheader(e,c[e]+""); (highlight)
the rest of site working well, ajax call returs error (tried post)
in 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 error
Comments
Post a Comment