Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I have this code on the client side:
- var dataObj={
- title:title
- };
- var dataJSON=JSON.stringify(dataObj);
- $.ajax({
- type:'POST',
- url:'/notebook/',
- data:dataJSON
- })
- .done(function(data){
- console.log("Notebook has been created");
- });
- I have this code(using express bodyParser)
- router.post('/',function(req,res){
- console.log(req.body);//
- console.log(req.body.title);
- /*var nb=new notebook({
- title:req.body.title,
- isActive:false
- });
- nb.save(function(err,doc){
- if(err)
- console.error(err);
- else
- {
- console.log("Notebook Document has been saved");
- console.log(doc);
- }
- });*/
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement