Reputation: 67
I am using a function which takes a callback paramater to which im passing my own function. I'm however getting the error function expected
GpsGate.Server.MyService.getTracksByUser(groupName, user.username, getTracksByUser_callback());
function getTracksByUser_callback(result)
{
var responseData = '<response>';
result.tracks.foreach( //error on this line
function addTrack(track) {
responseData += '<track>';
//ommited
responseData += '</track>';
}
);
responseData += '</response>';
response.body = responseData;
}
looking at examples http://msdn.microsoft.com/en-us/library/ie/ff679980(v=vs.94).aspx im unsure why it is not working
Upvotes: 0
Views: 428
Reputation: 843
You are not passing the function, you are executing the function and passing the result.
Remove the parenthesis:
GpsGate.Server.MyService.getTracksByUser(groupName, user.username, getTracksByUser_callback);
There is also the error Matt Burland pointed out in the comments, where it should be forEach
not foreach
.
Upvotes: 3