如何在不加载资源的情况下解析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
});