See you did one more mistake passing data in jquery method
and use your commented path where it will access webmethod there.
I have just copied your code tried it should like
$("#btnStartChat").click(function () {
var U= "ChatroomHome.aspx/CheckUser";
var name = $("#txtNickName").val();
$.ajax({
url: U,
data: "{Name: '" + name + "' }",
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
if(data.length>0) {
}
else {
alert("Please enter name");
}
},
error: function (ex) { }
});
});
thanks