just trying basic hello world while coding lingo game. response header 200, localhost node server outputs console i've sent response, yet response empty. tried without express , still comes empty. server-side code below:
var express = require('express'); var app = express(); app.get('/', function(req, res){ res.setheader('content-type', 'text/plain'); res.send("hello"); console.log("successful response"); }); app.listen(3001);
the client-side page below:
</head> <body> <div id='header'> <h2>welcome lingo!</h2> </div> <div id='game area'> <form action="" method="get"> <input type="text" value="" id="textfield"></input> <div id="select_div"><a href="#" id="select_link">test</a></div> </form> </div> <script type="text/javascript"> $(document).ready(function(){ $('#select_div').click(function(e){ $.get('http://localhost:3001',function(res){ alert("worked"); }); }); }); </script> </body> </html>
i've tried lot of different things , googled different questions none answer this. don't understand how can getting successful response header yet no response. , when attempt connect localhost:3001 in browser, response text there "hello" on page.
Comments
Post a Comment