Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Send post to Server

$
0
0

Hello, I dont know how to send a message from AJAX with some content to node js server.

 var formData = "name=ravi&age=31";  //Name value Pair
        or
        var formData = { name: "ravi", age: "31" }; //Array $.ajax({
            url: "http://127.0.0.1:8124/",
            type: "POST",
            data: formData,
            success: function (data, textStatus, jqXHR) {
                //data - response from server
            },
            error: function (jqXHR, textStatus, errorThrown) {

            }
        });


    </script>


And I want to send formData to node server:

How do I get  this message from ajax in node ?

var http = require('http');

http.createServer(function (req, res) {
    console.log('request received');
    res.writeHead(200, { 'Content-Type': 'text/plain' });

}).listen(8124);

Sth should be written there, but I dont know hot to get this message.




Viewing all articles
Browse latest Browse all 5678

Trending Articles