When I click a control with id of Button1 it calls a function called getMakes, I want to be able to pass a parameter to it. In this case the id of the control that will be receiving data. What am I doing wrong?
$(function () {
$('#Button1').click(getMakes("'#output'"))
$('#buttonClear').click(function () {
$('#output').html('');
});
});
function getMakes(myVar) {
$.ajax({
type: "POST",
url: "WebService.asmx/dbAccess2",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var response = msg.d;
$.each(response, function (index, value) {
$(myVar).append(new Option(value, index));
});
},
failure: function (msg) {
alert('failure');
}
});
}