import vueAxios from 'vue-axios => Uncaught SyntaxError: Unexpected identifier










-3














I have a problem using axios to post my data to my node.js server, it gives always an error.



I am loading axios using:



 import vueAxios from 'vue-axios'


I am confused, could somebody tell me what I should use to import axios or how I can send my data to the server without using forms?



appreciated!










share|improve this question



















  • 1




    what's that error?
    – Boussadjra Brahim
    Nov 12 '18 at 23:17










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
    – mojtaba1
    Nov 13 '18 at 13:38










  • i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
    – mojtaba1
    Nov 13 '18 at 13:41










  • I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
    – mojtaba1
    Nov 13 '18 at 13:44















-3














I have a problem using axios to post my data to my node.js server, it gives always an error.



I am loading axios using:



 import vueAxios from 'vue-axios'


I am confused, could somebody tell me what I should use to import axios or how I can send my data to the server without using forms?



appreciated!










share|improve this question



















  • 1




    what's that error?
    – Boussadjra Brahim
    Nov 12 '18 at 23:17










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
    – mojtaba1
    Nov 13 '18 at 13:38










  • i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
    – mojtaba1
    Nov 13 '18 at 13:41










  • I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
    – mojtaba1
    Nov 13 '18 at 13:44













-3












-3








-3


1





I have a problem using axios to post my data to my node.js server, it gives always an error.



I am loading axios using:



 import vueAxios from 'vue-axios'


I am confused, could somebody tell me what I should use to import axios or how I can send my data to the server without using forms?



appreciated!










share|improve this question















I have a problem using axios to post my data to my node.js server, it gives always an error.



I am loading axios using:



 import vueAxios from 'vue-axios'


I am confused, could somebody tell me what I should use to import axios or how I can send my data to the server without using forms?



appreciated!







node.js vue.js vue-router javascript-import






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 5:02









Graham

3,533123559




3,533123559










asked Nov 12 '18 at 23:10









mojtaba1mojtaba1

95




95







  • 1




    what's that error?
    – Boussadjra Brahim
    Nov 12 '18 at 23:17










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
    – mojtaba1
    Nov 13 '18 at 13:38










  • i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
    – mojtaba1
    Nov 13 '18 at 13:41










  • I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
    – mojtaba1
    Nov 13 '18 at 13:44












  • 1




    what's that error?
    – Boussadjra Brahim
    Nov 12 '18 at 23:17










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
    – mojtaba1
    Nov 13 '18 at 13:38










  • i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
    – mojtaba1
    Nov 13 '18 at 13:41










  • I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
    – mojtaba1
    Nov 13 '18 at 13:44







1




1




what's that error?
– Boussadjra Brahim
Nov 12 '18 at 23:17




what's that error?
– Boussadjra Brahim
Nov 12 '18 at 23:17












gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
– mojtaba1
Nov 13 '18 at 13:38




gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4. that is my code and the error is as follows require is not defined
– mojtaba1
Nov 13 '18 at 13:38












i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
– mojtaba1
Nov 13 '18 at 13:41




i changed my code and instead fo import I used require, but still doesn't work the error is : require is not defined.
– mojtaba1
Nov 13 '18 at 13:41












I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
– mojtaba1
Nov 13 '18 at 13:44




I used browserify too, but with bundle.js it doesn't work. I don't know where I should put my bundle.js. if it is near index.html, it gives error that it can not find bundle.js and if it is in js folder, again it says that require is not defined
– mojtaba1
Nov 13 '18 at 13:44












1 Answer
1






active

oldest

votes


















0














install



npm install axios


use in component



import axios from 'axios'


use in method:



axios.get(`/api/`).then(( data )





share|improve this answer




















  • I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
    – mojtaba1
    Nov 13 '18 at 8:28










  • post code in gist.github
    – Hamilton Gabriel
    Nov 13 '18 at 10:34










  • sorry, I am new in web-programming. how can I post it in gist.github.
    – mojtaba1
    Nov 13 '18 at 10:40










  • create account gist.github.com add filename, poste the code, click in add file
    – Hamilton Gabriel
    Nov 13 '18 at 10:42










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
    – mojtaba1
    Nov 13 '18 at 13:02











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271430%2fimport-vueaxios-from-vue-axios-uncaught-syntaxerror-unexpected-identifier%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














install



npm install axios


use in component



import axios from 'axios'


use in method:



axios.get(`/api/`).then(( data )





share|improve this answer




















  • I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
    – mojtaba1
    Nov 13 '18 at 8:28










  • post code in gist.github
    – Hamilton Gabriel
    Nov 13 '18 at 10:34










  • sorry, I am new in web-programming. how can I post it in gist.github.
    – mojtaba1
    Nov 13 '18 at 10:40










  • create account gist.github.com add filename, poste the code, click in add file
    – Hamilton Gabriel
    Nov 13 '18 at 10:42










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
    – mojtaba1
    Nov 13 '18 at 13:02
















0














install



npm install axios


use in component



import axios from 'axios'


use in method:



axios.get(`/api/`).then(( data )





share|improve this answer




















  • I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
    – mojtaba1
    Nov 13 '18 at 8:28










  • post code in gist.github
    – Hamilton Gabriel
    Nov 13 '18 at 10:34










  • sorry, I am new in web-programming. how can I post it in gist.github.
    – mojtaba1
    Nov 13 '18 at 10:40










  • create account gist.github.com add filename, poste the code, click in add file
    – Hamilton Gabriel
    Nov 13 '18 at 10:42










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
    – mojtaba1
    Nov 13 '18 at 13:02














0












0








0






install



npm install axios


use in component



import axios from 'axios'


use in method:



axios.get(`/api/`).then(( data )





share|improve this answer












install



npm install axios


use in component



import axios from 'axios'


use in method:



axios.get(`/api/`).then(( data )






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 23:37









Hamilton GabrielHamilton Gabriel

965




965











  • I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
    – mojtaba1
    Nov 13 '18 at 8:28










  • post code in gist.github
    – Hamilton Gabriel
    Nov 13 '18 at 10:34










  • sorry, I am new in web-programming. how can I post it in gist.github.
    – mojtaba1
    Nov 13 '18 at 10:40










  • create account gist.github.com add filename, poste the code, click in add file
    – Hamilton Gabriel
    Nov 13 '18 at 10:42










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
    – mojtaba1
    Nov 13 '18 at 13:02

















  • I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
    – mojtaba1
    Nov 13 '18 at 8:28










  • post code in gist.github
    – Hamilton Gabriel
    Nov 13 '18 at 10:34










  • sorry, I am new in web-programming. how can I post it in gist.github.
    – mojtaba1
    Nov 13 '18 at 10:40










  • create account gist.github.com add filename, poste the code, click in add file
    – Hamilton Gabriel
    Nov 13 '18 at 10:42










  • gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
    – mojtaba1
    Nov 13 '18 at 13:02
















I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
– mojtaba1
Nov 13 '18 at 8:28




I tried it but I caught this error(Uncaught SyntaxError: Unexpected identifier)
– mojtaba1
Nov 13 '18 at 8:28












post code in gist.github
– Hamilton Gabriel
Nov 13 '18 at 10:34




post code in gist.github
– Hamilton Gabriel
Nov 13 '18 at 10:34












sorry, I am new in web-programming. how can I post it in gist.github.
– mojtaba1
Nov 13 '18 at 10:40




sorry, I am new in web-programming. how can I post it in gist.github.
– mojtaba1
Nov 13 '18 at 10:40












create account gist.github.com add filename, poste the code, click in add file
– Hamilton Gabriel
Nov 13 '18 at 10:42




create account gist.github.com add filename, poste the code, click in add file
– Hamilton Gabriel
Nov 13 '18 at 10:42












gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
– mojtaba1
Nov 13 '18 at 13:02





gist.github.com/seebrucke/188e36f925c117ab3d45ba20395132f4 that is the link to gist thank you for your time
– mojtaba1
Nov 13 '18 at 13:02


















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271430%2fimport-vueaxios-from-vue-axios-uncaught-syntaxerror-unexpected-identifier%23new-answer', 'question_page');

);

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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3