Javascript AJAX SyntaxError: Unexpected token E in JSON at position 0 in ajax + node.js

I am making an AJAX POST request with multiple objects to a node.js server. Although my server sends status code 200, I am still getting the error Javascript AJAX SyntaxError: Unexpected token E in JSON at position 0. Here is my POST request:

     var company_id = "some_generic_id";
     var president  = "obama";

     var postData = {
       company_id   : company_id,
       president    : president
     };


     $.ajax({
       type: "POST",
       url: '/api/test_link',
       data: JSON.stringify(postData),
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       data: postData,
       success: function(data, status) {
         console.log('it worked!')
       },
       error: function(request, status, error) {
         console.log(request);
         console.log(status);
         console.log(error);
       }
     });

And here is my server side code:

app.post('/api/test_link', function(req, res) {

            console.log('--post data--');
            console.log(req.body);
            /*
                prints out:
                --post data--
                { company_id: 'company_id', president: 'obama' }

            */  
            res.sendStatus(200);

    });

Here’s an image from my network tab:

Network tab

Does anyone know what I might be missing or why my postData has invalid syntax?

218 thoughts on “Javascript AJAX SyntaxError: Unexpected token E in JSON at position 0 in ajax + node.js”

  1. great submit, very informative. I’m wondering why the other experts of this sector do not understand this.
    You must proceed your writing. I am confident, you have a great readers’ base already!

    Reply
  2. Pingback: cialis at costco
  3. Pingback: sildenafil rx
  4. I have been surfing online more than 3 hours today, yet I never
    found any interesting article like yours. It is pretty worth enough for me.
    In my view, if all web owners and bloggers made good content as you did, the web will be much more useful than ever before.

    Reply
  5. Woah! I’m really enjoying the template/theme of this site.

    It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between user friendliness and visual
    appearance. I must say you’ve done a awesome job with this.
    Also, the blog loads super fast for me on Chrome. Exceptional Blog!

    Reply
  6. Thanks for your valuable post. As time passes, I have come to be able to understand that the particular symptoms of mesothelioma cancer are caused by the particular build up associated fluid between lining on the lung and the torso cavity. The illness may start in the chest vicinity and propagate to other body parts. Other symptoms of pleural mesothelioma cancer include weight loss, severe respiration trouble, throwing up, difficulty ingesting, and puffiness of the neck and face areas. It needs to be noted that some people having the disease will not experience any serious symptoms at all.

    Reply
  7. Hello there! This article couldn’t be written much better!
    Reading through this post reminds me of my previous roommate!
    He continually kept preaching about this. I will send this article to him.
    Pretty sure he will have a very good read. Thanks for sharing!

    Reply
  8. Thanks for giving your ideas. A very important factor is that college students have a selection between federal government student loan plus a private education loan where it truly is easier to choose student loan debt consolidation loan than in the federal student loan.

    Reply
  9. I just could not leave your website before suggesting that I actually loved the
    usual info an individual provide to your guests?
    Is gonna be again steadily to inspect new posts

    Reply
  10. Good day! This is kind of off topic but I need some advice from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick.

    I’m thinking about setting up my own but I’m not sure where
    to start. Do you have any tips or suggestions? Thanks

    Reply
  11. I’m not sure why but this web site is loading incredibly slow for me.
    Is anyone else having this issue or is it a issue on my end?

    I’ll check back later and see if the problem still exists.

    Reply
  12. Hi there! This article couldn’t be written much better!
    Reading through this post reminds me of my previous roommate!

    He continually kept talking about this. I am going to send this information to him.

    Fairly certain he’s going to have a very good read. Thanks for sharing!

    Reply
  13. I will immediately grasp your rss feed as I can’t to find your email subscription hyperlink or
    e-newsletter service. Do you have any? Please let me understand so that I may
    subscribe. Thanks.

    Reply
  14. Hi there, simply become aware of your blog thru Google, and located that it is truly informative. I’m going to be careful for brussels. I will be grateful in case you continue this in future. Numerous people will likely be benefited out of your writing. Cheers!

    Reply
  15. I will right away snatch your rss feed as I can’t in finding your email subscription link or e-newsletter service.
    Do you’ve any? Kindly allow me realize so that I may just subscribe.
    Thanks.

    Reply
  16. It’s the best time to make a few plans for the long run and it’s time to be happy.

    I have learn this publish and if I may I wish to counsel you some attention-grabbing
    issues or tips. Maybe you can write subsequent articles regarding this article.
    I wish to read more issues about it!

    Reply
  17. I have been surfing online more than three hours today,
    yet I never found any interesting article like yours. It’s pretty worth enough
    for me. Personally, if all website owners
    and bloggers made good content as you did, the net will be a lot more useful than ever before.

    Reply
  18. I’ve been surfing on-line greater than three hours as of late, but I by no means discovered any fascinating article like yours.
    It is lovely value sufficient for me. In my opinion, if all webmasters
    and bloggers made excellent content material as you probably did,
    the internet will probably be much more
    helpful than ever before.

    Reply
  19. It’s the best time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I wish to suggest you some interesting things or tips.

    Maybe you could write next articles referring to this article.
    I wish to read even more things about it!

    Reply
  20. I am curious to find out what blog platform you are using?
    I’m having some small security issues with my latest site and
    I’d like to find something more secure. Do you have any recommendations?

    Reply
  21. Awesome site you have here but I was wondering if you knew of any
    message boards that cover the same topics talked about here?

    I’d really like to be a part of group where I can get responses from other experienced people that share the same interest.
    If you have any suggestions, please let me know. Thanks!

    Reply
  22. I have been browsing online more than 3 hours nowadays, yet I by no means
    found any interesting article like yours. It’s beautiful worth sufficient for me.
    In my view, if all web owners and bloggers made good content as
    you probably did, the internet will probably be much more useful than ever before.

    Reply
  23. Hmm it seems like your site ate my first comment (it was extremely long) so I guess I’ll just sum it up
    what I submitted and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to the whole thing.
    Do you have any tips and hints for rookie blog
    writers? I’d really appreciate it.

    Reply
  24. Rather than selecting a specific number of pre-flashes to ignore, adicione slave units have a learning mode in which
    firing one flash teaches them acessível which flash to synchronise.

    Reply
  25. Thank you for the auspicious writeup. It actually was a entertainment account it.
    Glance complicated to more introduced agreeable from you!
    However, how can we be in contact?

    Reply
  26. Excellent goods from you, man. I’ve understand your stuff
    previous to and you’re just too magnificent. I actually
    like what you have acquired here, certainly like what you’re saying and the way in which you
    say it. You make it enjoyable and you still care for to keep it smart.
    I cant wait to read much more from you. This is really a great website.

    Reply
  27. You are so cool! I don’t think I’ve read through anything
    like that before. So great to discover somebody with a few genuine thoughts on this
    subject. Really.. thank you for starting this up. This site is something that is needed on the web, someone with a little originality!

    Reply
  28. Hi, Neat post. There’s an issue together with your site in web explorer, could
    test this? IE still is the market leader and
    a good element of folks will leave out your great writing
    due to this problem.

    Reply
  29. I’m extremely impressed along with your writing talents as well as with the structure for your blog.
    Is that this a paid theme or did you customize it your self?
    Anyway stay up the excellent high quality writing, it’s uncommon to look a nice blog
    like this one today..

    Reply
  30. An intriguing discussion is worth comment. I believe that
    you ought to write more on this subject matter, it may not be a taboo subject but usually folks don’t talk about such
    issues. To the next! All the best!!

    Reply
  31. Having read this I thought it was very informative.
    I appreciate you finding the time and effort to put this information together.
    I once again find myself spending way too much time both reading and posting
    comments. But so what, it was still worth it!

    Reply
  32. We stumbled over here from a different page and thought I may as well
    check things out. I like what I see so i am just following you.

    Look forward to finding out about your web page yet again.

    Reply
  33. Interesting blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple tweeks would
    really make my blog stand out. Please let me know where you got your theme.
    Kudos

    Reply
  34. I’m truly enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more pleasant for me to come here and
    visit more often. Did you hire out a designer to create
    your theme? Excellent work!

    Reply
  35. Have you ever considered publishing an e-book or guest authoring
    on other sites? I have a blog based on the same topics you discuss and
    would really like to have you share some stories/information. I know my audience would value
    your work. If you are even remotely interested, feel free to shoot me an e mail.

    Reply
  36. Hey there! I just wanted to ask if you ever have any issues with hackers?
    My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no backup.
    Do you have any solutions to stop hackers?

    Reply
  37. My spouse and I stumbled over here by a different web page and
    thought I might check things out. I like what I see so
    now i’m following you. Look forward to looking at your web page repeatedly.

    Reply
  38. Hello there! This blog post could not be written much better!
    Looking through this article reminds me of my previous roommate!
    He continually kept preaching about this. I’ll send this information to him.
    Pretty sure he will have a very good read. Many thanks for sharing!

    Reply
  39. We’re a group of volunteers and starting a new scheme in our community.
    Your site offered us with valuable info to work on. You’ve done a formidable job and our whole community will be thankful to you.

    Reply
  40. No matter if some one searches for his essential thing,
    thus he/she wishes to be available that in detail, thus that thing is maintained over here.

    Reply
  41. Greetings! I know this is kinda off topic but I was wondering if
    you knew where I could get a captcha plugin for
    my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

    Reply
  42. I believe what you wrote made a great deal of sense.
    But, consider this, suppose you were to write a killer title?
    I am not suggesting your information is not good.,
    but suppose you added something to maybe grab folk’s attention? I mean Javascript AJAX SyntaxError: Unexpected token E in JSON at position 0
    in ajax + node.js – JavaScript Help is a little vanilla.
    You should peek at Yahoo’s home page and note how they write article titles
    to get people to click. You might add a video or a related pic or two to get
    readers interested about everything’ve got to say. In my opinion, it would make
    your posts a little livelier.

    Reply
  43. I was very happy to uncover this web site. I wanted to thank
    you for ones time for this particularly wonderful read!!
    I definitely loved every little bit of it and I have you saved
    to fav to see new information on your site.

    Reply
  44. Wow, awesome weblog structure! How long have you ever
    been running a blog for? you made blogging look easy.
    The total glance of your website is excellent, as well as the content material!

    Reply
  45. I am really enjoying the theme/design of your blog. Do
    you ever run into any web browser compatibility problems?
    A small number of my blog visitors have complained about my website not operating correctly in Explorer but looks great in Opera.
    Do you have any solutions to help fix this problem?

    Reply
  46. I have been browsing online more than 2 hours today, yet I never found any
    interesting article like yours. It’s pretty
    worth enough for me. Personally, if all website owners and bloggers made good content as you did, the net will be much more useful than ever before.

    Reply
  47. It is appropriate time to make some plans for the future and
    it is time to be happy. I have read this post and if I could I want to suggest you some interesting things or suggestions.

    Maybe you can write next articles referring to this article.
    I wish to read even more things about it!

    Reply
  48. Have you ever thought about including a little bit more than just your articles?
    I mean, what you say is valuable and everything.
    But think about if you added some great pictures or video clips to give your posts more,
    “pop”! Your content is excellent but with images and videos, this blog could
    certainly be one of the best in its niche. Amazing blog!

    Reply
  49. Thanks for any other informative website. The place else may I get that type
    of info written in such an ideal means? I’ve a mission that I am just
    now running on, and I’ve been at the look out for such information.

    Reply
  50. Pretty part of content. I just stumbled
    upon your web site and in accession capital to assert that I acquire in fact
    enjoyed account your blog posts. Any way I’ll be subscribing for your
    augment or even I achievement you get right of entry to consistently quickly.

    Reply
  51. Hello there! This article could not be written much better!
    Looking at this post reminds me of my previous roommate!
    He constantly kept preaching about this. I most certainly will forward this post to him.
    Fairly certain he’s going to have a very good read.
    I appreciate you for sharing!

    Reply
  52. I’ve been browsing online more than 2 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. In my view, if all site owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

    Reply
  53. Woah! I’m really digging the template/theme of this site.

    It’s simple, yet effective. A lot of times it’s difficult to get that
    “perfect balance” between user friendliness and appearance.
    I must say that you’ve done a fantastic job with
    this. In addition, the blog loads very fast for me on Firefox.
    Outstanding Blog!

    Reply
  54. It’s appropriate time to make some plans for the future and it is time to be
    happy. I have read this post and if I could I want to suggest you few interesting things or advice.

    Perhaps you could write next articles referring to this article.
    I want to read even more things about it!

    Reply
  55. Hello there! This article could not be written any
    better! Reading through this article reminds me of my
    previous roommate! He continually kept talking about this.
    I will forward this information to him. Fairly certain he’s going
    to have a good read. Many thanks for sharing!

    Reply
  56. I like the helpful information you provide in your articles.
    I will bookmark your weblog and check again here regularly.

    I’m quite certain I will learn plenty of new
    stuff right here! Best of luck for the next!

    Reply
  57. Heya! I’m at work browsing your blog from
    my new apple iphone! Just wanted to say I love
    reading through your blog and look forward to all
    your posts! Keep up the superb work!

    Reply
  58. It’s a pity you don’t have a donate button! I’d most certainly donate to this excellent blog!
    I suppose for now i’ll settle for book-marking and adding
    your RSS feed to my Google account. I look forward to new
    updates and will talk about this website with my Facebook
    group. Chat soon!

    Reply
  59. I have been surfing online more than three hours today, yet I never found any
    interesting article like yours. It’s pretty worth enough for me.
    In my opinion, if all website owners and bloggers made good content as you
    did, the web will be a lot more useful than ever before.

    Reply
  60. I simply could not leave your website before suggesting that I actually enjoyed the standard
    information a person supply to your visitors? Is going to be back frequently
    to check out new posts

    Reply
  61. I have really learned newer and more effective things by means of your weblog. One other thing I would really like to say is that often newer laptop operating systems have a tendency to allow extra memory for use, but they as well demand more memory simply to function. If people’s computer is not able to handle more memory along with the newest program requires that storage increase, it can be the time to shop for a new Computer system. Thanks

    Reply
  62. Hi, I do believe this is a great blog. I stumbledupon it ;
    ) I am going to come back yet again since I book-marked it.

    Money and freedom is the greatest way to change, may you be rich and continue to help others.

    Reply
  63. Thank you a bunch for sharing this with all of us you actually recognize what you
    are speaking approximately! Bookmarked. Kindly additionally seek advice from my website =).
    We may have a link change arrangement between us

    Reply
  64. Hi, I do believe this is an excellent blog.
    I stumbledupon it 😉 I will revisit yet again since i have saved as a favorite it.

    Money and freedom is the best way to change, may you be rich and continue to guide others.

    Reply
  65. It’s the best time to make some plans for the future and it is time to be happy.
    I’ve learn this submit and if I could I want to counsel you few fascinating
    things or suggestions. Perhaps you could write subsequent articles regarding this article.
    I desire to learn even more issues about it!

    Reply
  66. Hey there just wanted to give you a quick heads up. The words in your article seem
    to be running off the screen in Safari. I’m not sure if this is a
    format issue or something to do with internet browser compatibility but I thought I’d post to let you know.
    The design look great though! Hope you get the issue resolved
    soon. Thanks

    Reply
  67. Just wish to say your article is as amazing. The clearness in your post is simply nice and i could assume you’re an expert on this
    subject. Well with your permission allow me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please continue the enjoyable work.

    Reply
  68. You are so cool! I do not suppose I have read through anything like
    that before. So good to find someone with a few unique thoughts on this subject matter.
    Seriously.. many thanks for starting this up. This site is something that is needed on the internet,
    someone with some originality!

    Reply

Leave a Comment