Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &美元。post不是一项功能;在IBM Watson Assistant聊天机器人中_Javascript_Ibm Cloud_Chatbot_Watson Assistant_.post - Fatal编程技术网

Javascript &美元。post不是一项功能;在IBM Watson Assistant聊天机器人中

Javascript &美元。post不是一项功能;在IBM Watson Assistant聊天机器人中,javascript,ibm-cloud,chatbot,watson-assistant,.post,Javascript,Ibm Cloud,Chatbot,Watson Assistant,.post,我试图存储从WatsonAssistantchat收到的JSON值,下面是代码: const element = document.querySelector('.chatElement'); window.watsonAssistantChatOptions = { integrationID: "xx", serviceInstance

我试图存储从WatsonAssistantchat收到的JSON值,下面是代码:

const element = document.querySelector('.chatElement');
                    window.watsonAssistantChatOptions = {
                        integrationID: "xx", 
                        serviceInstanceID: "xx",
                        
                        onLoad: function (instance) {
                                    /*
                                    Handler functions able the
                                    */
                                    function handler(event) {
                                    var response= event.data.output;
                                    ***json_response = JSON.stringify(response);***// JSON pack
                                    console.log(json_response); 
                                    ***$.post("chat/home.html", json_response);***
                            }
                            instance.on({ type: "receive", handler: handler });
                                    // Actually render the web chat.
                                    instance.render();
                                }

                            };

                            setTimeout(function () { 
                                const t = document.createElement('script'); 
                                t.src = 'https://web-chat.global.assistant.watson.appdomain.cloud/loadWatsonAssistantChat.js'; 
                                document.head.appendChild(t); 
                            });
我曾尝试使用$.post存储该变量,并在我的view.py中使用它来填充我的数据库,但在执行代码时收到此错误

$.post不是一个函数

关于它的文档说我必须更改jQuery的源代码,但它实际上不起作用。也许我在JS结构方面失败了。如果有人能帮我改正,那就太棒了。
谢谢

你能链接到文档吗?你在哪里运行上面的代码?您如何接收数据?添加更多细节。我真的没有文档,这就是为什么我如此绝望。我在前端运行了这段代码。我从WA接收JSON格式的数据,这是一个聊天机器人。