Ajax响应作为DOM对象 [英] Ajax response as DOM object

查看:83
本文介绍了Ajax响应作为DOM对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以从典型的ajax函数获取响应,以便可以使用getElements对其进行剖析?我已经尝试过query.responseText.getElementById,但是它的效果和它看起来一样糟糕.但是,您应该可以通过查看该片段来告诉我我要实现的目标.我只需要从ajax响应中获取元素即可,就像处理普通DOM对象一样.

Is there a way to get a response from the typical ajax function so that it can be dissected with getElements? I've tried query.responseText.getElementById but it works just as bad as it looks. You should be able to tell what I'm trying to achieve by seeing that snippet, though. I just need to get elements from an ajax response the same way as I would a normal DOM object.

此外,请建议使用jQuery.当我有很多脚本并且可以使用它的许多功能时,我会使用它,但是在这种情况下,我只有一个简短的脚本和一个70倍于其大小的库,这似乎是一种浪费.

Also, please do not suggest using jQuery. I use it when I have a lot of script and can use a lot of its functions, but in this case I only have a short script and a library 70x the size of it would seem like a waste.

推荐答案

doc 将是有效的html文档.

doc will be a valid html document.

这篇关于Ajax响应作为DOM对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆