jquery 从 get 调用中选择脚本节点
我想通过 ajax get 调用中的 id 选择一个脚本节点。
<script id="jqgrid_js" type="text/javascript">
...
</script>
get 调用:
$.get(url, function(results){
console.debug(results); //the jqgrid_js is included in the result
console.debug($('#jqgrid_js')); //this returns the node from the actual page
console.debug($('#jqgrid_js', results)); // in the result I can not select it
var jqgrid_js = $('#jqgrid_js', results);
//do the update
$('#jqgrid_js').html(jqgrid_js);
}, "html");
我想知道为什么相同的 select 语句不返回节点,而节点肯定包含在“结果”变量中。
I want to select a script node by id from a ajax get call.
<script id="jqgrid_js" type="text/javascript">
...
</script>
The get call:
$.get(url, function(results){
console.debug(results); //the jqgrid_js is included in the result
console.debug($('#jqgrid_js')); //this returns the node from the actual page
console.debug($('#jqgrid_js', results)); // in the result I can not select it
var jqgrid_js = $('#jqgrid_js', results);
//do the update
$('#jqgrid_js').html(jqgrid_js);
}, "html");
I'm wondering why the same select statement does not return the node, whereas the node is definitely included in the "results" var.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试扭转这个局面并使用
find
代替:Try turning this around and using
find
instead: