Your code is correct there is no problem with it
but you might be including the new jquery library which doesn't allow .success() method
for newer version of jquery use
$.ajax({
type: "GET",
url: "/api/rooms",
success: function (rooms) {
}
});
and if you are using old jquery the .success() method would run without any problem
$.ajax({
url: "/api/rooms",
method: "GET",
data: {'datavar': datavalue}
}).success(function (rooms) {
console.log("successfully run ajax request..." + rooms);
}).done(function () {
console.log("I am from done function");
}).fail(function () {
console.log("I am from fail function.");
}).always(function () {
console.log("I am from always function");
});