I modified your code. See if it works :
$(document).ready(function () {
$("#btnUploadFile").click(function (e) {
$.ajax({
type: 'POST',
data: '{name: "' + $("#<%=txtUserName.ClientID%>")[0].value + '" }',
url: "SortGrid.aspx/UploadEmployees",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(msg.d);
}
});
e.preventDefault();
});
});
[System.Web.Services.WebMethod]
public static string UploadEmployees(string name)
{
try
{
return name;
}
catch (Exception)
{
throw;
}
}
Good luck