Tuesday 6 June 2017

Ajax request not working in loopback

I am beginner in loopback and working on Get Post in loopback This is code on client side

var datas = 'Something';    
 $.ajax({   
      type: 'POST',   
      url: '/post',  
      data: datas,  
      dataType: 'text'  
       })  
         .done(function(data) {  
            console.log('Successful');  
         .fail(function(jqXhr) {  
            console.log('Failed');  

});

and this is on server side(server.js)

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


 console.log('This is DATA '+ req.body);      

});

This is not working it gives me 404 not found or failed.
What am I doing wrong and Is there another method for get post in loopback?



via Zunnurain Badar

No comments:

Post a Comment