如何在不加载资源的情况下解析AJAX响应? [英] How to parse AJAX response without loading resources?

查看:69
本文介绍了如何在不加载资源的情况下解析AJAX响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器中加载了一堆包含img标签的HTML.我需要解析此响应(我只需要一小部分),并找到一些特定的标签.

I load a bunch of HTML from the server containing img-tags. I need to parse this response (I need only a small part of it) and find a few particular tags.

问题是,一旦我将响应放入jQuery进行解析,浏览器就会加载所有包含的图像.这部分是不必要的(我不需要大多数),但是最大的问题是它们是通过HTTP在SSL环境中加载的.

Problem is, as soon as I throw the response into jQuery to parse it, the browser loads all contained images. This is partly unnecessary (I don't need most of them), but the biggest problem is that they are loaded via HTTP in an SSL-environment.

有没有一种方法可以解析HTML字符串而不加载包含的图像?

Is there a way to parse an HTML-string without loading the contained images?

推荐答案

您应该能够在return函数中解析响应.

You should be able to parse the response inside the return function.

$.get(url, data, function(html)
{
    // Parse here
});

这篇关于如何在不加载资源的情况下解析AJAX响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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