jQuery的AJAX只获取一个来自其他网页的div块 [英] jquery ajax fetch only one div block from other page

查看:151
本文介绍了jQuery的AJAX只获取一个来自其他网页的div块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个成功的Ajax请求,可以下载整个HTML内容,现在我只需要得到其中包含ID数据今天。

I have a succeed ajax request that can download the whole html contents, now I only need to get a div tag which contains id "data-today".

如何code这样的脚本?

How to code such a script?

推荐答案

看看这个SOQ:

这些方针的东西:

success: function(data) {
   //create jquery object from the response html
   var $response=$(data);
   //query the jq object for the values
   var dataToday = $response.find('#data-today').text();
}

这篇关于jQuery的AJAX只获取一个来自其他网页的div块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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