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)
}
});
});