Uncaught TypeError: Object function

640 Views Asked by At

I'm trying to implement ChatJS (chatjs.net) in web program. When I add all the scripts and and use this code:

  $.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()
});

The web browser throws an error:

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

How can I fix this? If this can't be fixed easily, can someone recommend a similar open source program?

1

There are 1 best solutions below

0
On BEST ANSWER

After I rechecked my code, I realized that I forgot include a JS library. After I included it, it started working.