Passing a Variable Into a Callback Function

In the below code, is it possible to put an additional parameter on the callback function so that a variable can be passed into it? I’d like to use that variable within the AssertResults(); function being called within the callback function. Thanks.

$http.get(options, callback);

function callback (err, response, body){
  results = JSON.parse(body).results[0].count;
  console.log("results: " + results);

Hi @BigNStrauss - Have a look at my API template as I think this is the approach that you are after.

1 Like

@stefan_garnham This works for me, thanks!

1 Like