实测可行的监听div里面的内容变化的方法

console.log($("#notebook_name").text());里面的内容按照网速不同页面加载速度,导致有的时候页面加载就用内容,有的时候却没有。因此需要监听里面的内容是否变化。用如下的方法

 $("#notebook_name").bind('DOMNodeInserted', function (e) {
console.log("变化了")
});

jupyter notebook里面的一个实例如下

            console.log("11-------------------")
            console.log($("#notebook_name").text());
            console.log("11-------------------")
            
            $("#notebook_name").bind('DOMNodeInserted', function (e) {
            console.log("22-------------------")
            console.log($("#notebook_name").text());
            console.log("22-------------------")
                $.ajax({
                    url: 'http://127.0.0.1:9000/notebooknameserver',//http://127.0.0.1:9000/jupyterserver?callbackfun=jsonpCallback&jupyter_result=jupyter_result
                    type: 'get',
                    dataType: 'jsonp',
                    jsonp: "callbackfun",//传递给请求处理程序或页面的,用以获得jsonp回调函数名的参数名(默认为:callback)
                    data: {
                        notebook_name: $("#notebook_name").text(),
                    },
                    success: function (data) {
                        console.log(data)
                    }
                });
            });

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值