This is the final section of the process for saving new topics to database. Now, we have to implement the saveNewTopic function defined in the events section, as shown in the following code:
saveNewTopic: function(event) { var options = { success: function (response) { if("error" == response.changed.status){ } }, error: function (model, error) { console.log(error); } }; var topic = new Topic(); var topic_title = $("#wpwaf_topic_title").val(); var topic_content = $("#wpwaf_topic_content").val(); var topic_forum = $("#wpwaf_topic_forum").val(); var forum_member_id = $("#wpwaf_topic_forum_member").val(); topicsList.add(topic); topicsList.create({ topic_title: topic_title, topic_content:topic_content, ...