I'm using a web service to populate a selection list and I now need to do the same for a number of selection lists ideally using the same method to try and limit the amount of code. Here's the method I use to make my web service call:
function GetColourReferences(self) {
$.ajax({
async: false,
cache: false,
type: 'GET',
url: '/GetColourReferences',
success: function (data) {
self.colourReferences(data);
}
});
}
I've tried something similar to the following but I can't get it to work - is it even possible?
function GetReferences(self, list, refUrl) {
$.ajax({
async: false,
cache: false,
type: 'GET',
url: refUrl,
success: function (data) {
list(data);
}
});
}
Here's how I'd call it (I'm using Knockout):
GetReferences(self, self.colourReferences, '/GetColourReferences');
Thanks for looking :)