0

I want to execute a function inside a remote URL. I know the page URL where the function is and I know the Function name too. The server-side application is built on NodeJs Express. And the function itself look like this

    function executer(param1, parama2){
    //logic
    return true;
}

Is there any way to achieve this?

1
  • You must know an endpoint(url) that leads to a function and then just call it using AJAX for example. Commented Mar 15, 2018 at 11:55

2 Answers 2

1

You can use for example an AJAX call to trigger an endpoint on server like this:

$.ajax({
  url: "/remoteservice/executer/",
  type: "get",
  data: {"param1": "param1","param2":"param2"}, 
  success: function(result){
    alert("Job is done");
  }
});

But you need to know the endpoint(url) and the method that it waits(get, post or whatever)

Sign up to request clarification or add additional context in comments.

2 Comments

Which one is the function name here??
Function name here is url, it's a remote API address.
1

If it is some API. Then you can use any node module for request like request or node-fetch. First is for callback and second for promises based. Examples are listed in modules description.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.