0

我正在尝试在网络程序中实现 ChatJS (chatjs.net)。当我添加所有脚本并使用此代码时:

  $.chat({
    // your user information
    user: {
        Id: 3,
        Name: 'John Silver',
        ProfilePictureUrl: 'http://www.foo.com/avatar/123'
    },
    // text displayed when the other user is typing
    typingText: ' is typing...',
    // the title for the user's list window
    titleText: 'ChatJS demo chat',
    // text displayed when there's no other users in the room
    emptyRoomText: "There's no one around here.",
    // the adapter you are using. There are 2 implementations out of the box:
    // SignalRAdapter and LongPollingAdapter (server independent).
    adapter: new LongPollingAdapter()
});

Web 浏览器抛出错误:

Uncaught TypeError: Object function (e,n){return new x.fn.init(e,n,t)} has no method 'chat' localhost:8000/try2/:253 (anonymous function)

我怎样才能解决这个问题?如果这不能轻易解决,有人可以推荐一个类似的开源程序吗?

4

1 回答 1

0

在我重新检查了我的代码后,我意识到我忘记了包含一个 JS 库。在我包含它之后,它开始工作。

于 2013-12-31T15:42:43.197 回答