Getting a json back from express.js using a jQuery get method does not work
I am trying to pass a value as JSON from my back end to the front end of my application. I am currently running express.js and the connection for all post methods is PERFECT.
Upon a button click in the FRONT-END in my application I want to get back an invoice number from my server.
On the front end my code looks like this with jQuery:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
On the back end it looks like this:
app.get("/invoiceNumber", function(req, res) {
res.json({ number: 4 });
});
Currently I am passing 4 just as a test.
The Error I am getting is:
GET http://127.0.0.1:3000/invoiceNumber 404 (Not Found)
If I try to go directly to:
http://127.0.0.1:3000/invoiceNumber
I get:
Cannot GET /invoiceNumber
javascript jquery express server get
add a comment |
I am trying to pass a value as JSON from my back end to the front end of my application. I am currently running express.js and the connection for all post methods is PERFECT.
Upon a button click in the FRONT-END in my application I want to get back an invoice number from my server.
On the front end my code looks like this with jQuery:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
On the back end it looks like this:
app.get("/invoiceNumber", function(req, res) {
res.json({ number: 4 });
});
Currently I am passing 4 just as a test.
The Error I am getting is:
GET http://127.0.0.1:3000/invoiceNumber 404 (Not Found)
If I try to go directly to:
http://127.0.0.1:3000/invoiceNumber
I get:
Cannot GET /invoiceNumber
javascript jquery express server get
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59
add a comment |
I am trying to pass a value as JSON from my back end to the front end of my application. I am currently running express.js and the connection for all post methods is PERFECT.
Upon a button click in the FRONT-END in my application I want to get back an invoice number from my server.
On the front end my code looks like this with jQuery:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
On the back end it looks like this:
app.get("/invoiceNumber", function(req, res) {
res.json({ number: 4 });
});
Currently I am passing 4 just as a test.
The Error I am getting is:
GET http://127.0.0.1:3000/invoiceNumber 404 (Not Found)
If I try to go directly to:
http://127.0.0.1:3000/invoiceNumber
I get:
Cannot GET /invoiceNumber
javascript jquery express server get
I am trying to pass a value as JSON from my back end to the front end of my application. I am currently running express.js and the connection for all post methods is PERFECT.
Upon a button click in the FRONT-END in my application I want to get back an invoice number from my server.
On the front end my code looks like this with jQuery:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
On the back end it looks like this:
app.get("/invoiceNumber", function(req, res) {
res.json({ number: 4 });
});
Currently I am passing 4 just as a test.
The Error I am getting is:
GET http://127.0.0.1:3000/invoiceNumber 404 (Not Found)
If I try to go directly to:
http://127.0.0.1:3000/invoiceNumber
I get:
Cannot GET /invoiceNumber
javascript jquery express server get
javascript jquery express server get
asked Nov 23 at 9:42
Pok3r Princ3
187
187
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59
add a comment |
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59
add a comment |
2 Answers
2
active
oldest
votes
it looks that this question is duplicated How to allow CORS?
So you can enable all cors requests with
npm install cors
your App.js
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
app.get('/products/:id', function (req, res, next) {
res.json({msg: 'This is CORS-enabled for all origins!'})
})
app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
you can find additional information here
https://expressjs.com/en/resources/middleware/cors.html#enable-cors-for-a-single-route
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm usingexpress.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always getGET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...
– Pok3r Princ3
Nov 23 at 12:37
|
show 4 more comments
Looks to me like you need to refrence where you back end is running from:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
if your express app is running on port 3000, change your front end to the following:
$.get("localhost:3000/invoiceNumber", function(data) {
console.log(data.number);
});
This allowed me to access the"localhost:3000/invoiceNumber"
path in the browser, but i'm getting aAccess to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.
– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444108%2fgetting-a-json-back-from-express-js-using-a-jquery-get-method-does-not-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
it looks that this question is duplicated How to allow CORS?
So you can enable all cors requests with
npm install cors
your App.js
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
app.get('/products/:id', function (req, res, next) {
res.json({msg: 'This is CORS-enabled for all origins!'})
})
app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
you can find additional information here
https://expressjs.com/en/resources/middleware/cors.html#enable-cors-for-a-single-route
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm usingexpress.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always getGET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...
– Pok3r Princ3
Nov 23 at 12:37
|
show 4 more comments
it looks that this question is duplicated How to allow CORS?
So you can enable all cors requests with
npm install cors
your App.js
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
app.get('/products/:id', function (req, res, next) {
res.json({msg: 'This is CORS-enabled for all origins!'})
})
app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
you can find additional information here
https://expressjs.com/en/resources/middleware/cors.html#enable-cors-for-a-single-route
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm usingexpress.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always getGET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...
– Pok3r Princ3
Nov 23 at 12:37
|
show 4 more comments
it looks that this question is duplicated How to allow CORS?
So you can enable all cors requests with
npm install cors
your App.js
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
app.get('/products/:id', function (req, res, next) {
res.json({msg: 'This is CORS-enabled for all origins!'})
})
app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
you can find additional information here
https://expressjs.com/en/resources/middleware/cors.html#enable-cors-for-a-single-route
it looks that this question is duplicated How to allow CORS?
So you can enable all cors requests with
npm install cors
your App.js
var express = require('express')
var cors = require('cors')
var app = express()
app.use(cors())
app.get('/products/:id', function (req, res, next) {
res.json({msg: 'This is CORS-enabled for all origins!'})
})
app.listen(80, function () {
console.log('CORS-enabled web server listening on port 80')
})
you can find additional information here
https://expressjs.com/en/resources/middleware/cors.html#enable-cors-for-a-single-route
edited Nov 23 at 11:55
answered Nov 23 at 10:05
Ishikawa Yoshi
1,01041740
1,01041740
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm usingexpress.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always getGET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...
– Pok3r Princ3
Nov 23 at 12:37
|
show 4 more comments
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm usingexpress.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always getGET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...
– Pok3r Princ3
Nov 23 at 12:37
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
I've installed & implemented the cors module, but i still get the same error. Any other ideas ?
– Pok3r Princ3
Nov 23 at 11:04
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
'Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin '127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.' this error 100% means that problem in cors
– Ishikawa Yoshi
Nov 23 at 11:12
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
so you can see on screenshot that this should works, you need to check your code. Or post it here and we check
– Ishikawa Yoshi
Nov 23 at 11:39
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
@Pok3rPrinc3 feel free to ask if you need any additional help
– Ishikawa Yoshi
Nov 23 at 11:59
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm using
express.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always get GET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...– Pok3r Princ3
Nov 23 at 12:37
Thanks for the time that you've put in helping me out Ishikawa, i'm trying to do all this to basically achieve this functionality: I'm using
express.js
and i have a server.js file in the root dir. of my project, and i have a public folder that i serve to the user's browser. I want to create a file in the root dir similar to the server.js (to be able to require NPM modules) that i can access from another file, in the public folder. If i try to do that right now i always get GET http://127.0.0.1:3000/invoices.js 404 (Not Found)
I've tried ajax .get, plain .get, fetch full path, etc...– Pok3r Princ3
Nov 23 at 12:37
|
show 4 more comments
Looks to me like you need to refrence where you back end is running from:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
if your express app is running on port 3000, change your front end to the following:
$.get("localhost:3000/invoiceNumber", function(data) {
console.log(data.number);
});
This allowed me to access the"localhost:3000/invoiceNumber"
path in the browser, but i'm getting aAccess to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.
– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
add a comment |
Looks to me like you need to refrence where you back end is running from:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
if your express app is running on port 3000, change your front end to the following:
$.get("localhost:3000/invoiceNumber", function(data) {
console.log(data.number);
});
This allowed me to access the"localhost:3000/invoiceNumber"
path in the browser, but i'm getting aAccess to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.
– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
add a comment |
Looks to me like you need to refrence where you back end is running from:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
if your express app is running on port 3000, change your front end to the following:
$.get("localhost:3000/invoiceNumber", function(data) {
console.log(data.number);
});
Looks to me like you need to refrence where you back end is running from:
$.get("/invoiceNumber", function(data) {
console.log(data.number);
});
if your express app is running on port 3000, change your front end to the following:
$.get("localhost:3000/invoiceNumber", function(data) {
console.log(data.number);
});
answered Nov 23 at 9:51
Luke Walker
27514
27514
This allowed me to access the"localhost:3000/invoiceNumber"
path in the browser, but i'm getting aAccess to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.
– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
add a comment |
This allowed me to access the"localhost:3000/invoiceNumber"
path in the browser, but i'm getting aAccess to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.
– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
This allowed me to access the
"localhost:3000/invoiceNumber"
path in the browser, but i'm getting a Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.– Pok3r Princ3
Nov 23 at 9:58
This allowed me to access the
"localhost:3000/invoiceNumber"
path in the browser, but i'm getting a Access to XMLHttpRequest at 'localhost:3000/invoiceNumber' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I'm also using Allow-Control-Allow-Origin: * to work around the Chrome restriction on localhost.– Pok3r Princ3
Nov 23 at 9:58
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Yes, Cors is a cross origin restiction, if your on chrome theres a chrome extention called "Moesif CORS" which will disable CORS for you.
– Luke Walker
Nov 23 at 10:04
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
Didn't work with that as well.
– Pok3r Princ3
Nov 23 at 11:10
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444108%2fgetting-a-json-back-from-express-js-using-a-jquery-get-method-does-not-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you started the server ? app.listen(3000)
– Pranoy Sarkar
Nov 23 at 9:48
expressjs.com/en/resources/middleware/cors.html
– Ishikawa Yoshi
Nov 23 at 9:59