Saturday 20 May 2017

call nodejs file onclick function

Basicaly i have a function called Register() in my javascript script.js.

Inside this function, i should call a nodejs file called sms.js.

sms.js is a CORS enabled, which calls an API and then it return some JSON

I want to get this JSON response inside my Register() function of my javascript

What is the ideal way to achieve this? Usually when i run node sms.js this API is called and i am getting the required JSON response

Inside my Register function i have

$.get('/#/request', function(list) {
    console.log(list);
});

Inside my sms.js function i have

app.get('/#/request', function(req, res){
});

So this doesnt work at all.. because node sms.js have to run.. How to do this?



via Matarishvan

No comments:

Post a Comment