I\'m trying to create a Javascript chat, with Python on the backend. This is the code I\'m using ...
<
This happens when you define the functions in the head part and call them, when the document is not yet initialized. Move the script part, where the initialization happens and try it out.
Since you are using jQuery, it would also be better, if you can initialize the variables and enclose the whole script under a function and call the function inside document's ready state, it would probably work.
$(document).ready(function(){
var chat_id = 1;
init_chat({{ chat_id }}, "chat");
// Something wrong here. Is it really chat_id inside {{ }}?
});