I've got the following JQuery code, which works fine if the VendorDropDown.ClientID is an integer, or a string that can be converted to an integer, but breaks if I try to use a string value like "Microsoft". The PopulateSoftware function is an Asp.Net WebMethod that takes a string parameter named vendorId.
var pageUrl = '<%=ResolveUrl("~/Default.aspx")%>'
function PopulateSoftwareDropdown() {
alert('{vendorId: ' + $('#<%=VendorDropDown.ClientID%>').val() + '}');
$.ajax({
type: "POST",
url: pageUrl + '/PopulateSoftware',
data: '{vendorId: ' + $('#<%=VendorDropDown.ClientID%>').val() + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSoftwarePopulated,
failure: function (response) {
alert(response.d);
}
});
}