Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8276375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:21:14+00:00 2026-06-08T08:21:14+00:00

I have the following in myserver/index.js (which I run with node): server.configure(function() { server.use(express.methodOverride());

  • 0

I have the following in myserver/index.js (which I run with node):

server.configure(function() {
  server.use(express.methodOverride());
  server.use(express.bodyParser());
  server.use(server.router);
  server.use(express.static(__dirname + '/public'));
  server.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

server.post('/signup/submit', function(req, res) {
  console.log(req);
  res.send(req.body);
});

server.listen(process.env.PORT || 12345, function() {
  console.log('Server listening');
});

I have the following in the <script> section of my myserver/public/signup/index.html file

function submit() {
  $.ajax({
    url: "submit",
    type: "POST",
    contentType: "application/xml",
    data: '<?xml version="1.0"?><user>John Smith</user>',
    dataType: "xml",
    success: function(data, textStatus, jqXHR) { alert(data); },
    error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }
});

When submit() gets called, an alert pops up saying “Error: Invalid XML: {}”. From the console dump of req, I see that body is indeed empty, but further examination shows that it has received all the other data. Here is the header:

headers: 
{ host: 'localhost:12345',
  connection: 'keep-alive',
  'content-length': '44',
  origin: 'http://localhost:12345',
  'x-requested-with': 'XMLHttpRequest',
  'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11',
  'content-type': 'application/xml',
  accept: 'application/xml, text/xml, */*; q=0.01',
  referer: 'http://localhost:12345/signup/',
  'accept-encoding': 'gzip,deflate,sdch',
  'accept-language': 'en-US,en;q=0.8',
  'accept-charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3' }

I’m new to Ajax, jQuery, and Node.js, so I don’t know what I’m doing wrong. I feel like it’s something little I’m missing.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:21:16+00:00Added an answer on June 8, 2026 at 8:21 am

    Try this:

    $.ajax({
        url: "submit",
        type: "POST",
        contentType: "application/xml",
        data: "<user>John Smith</user>", // remove <?xml ...
        dataType: "xml",
        success: function(data, textStatus, jqXHR) { alert(data); },
        error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my server I have directory reset, which contains 3 files index.php , 1.php,
I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&amp;web=%2F&amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
Visual Studio C++ 2008 I have the following code in my server.h file. #if
I have the following code. I want to use the methods for myserver1 and
I have placed .htaccess file in my server's root folder with following content: Redirect
I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&amp;web=%2F&amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
I have following code for testing the server connectivity. I have a device that
I have the following code used to post data to a remote server: NSString
See Server Fault: How do I configure proxy settings for LOCAL SYSTEM? I have
I have the following solution: MySolution -Project: MyServer (WPF) -Project: MyClient (WPF) -Project: MyLibrary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.