PHP方面的,急求! phpjqueryajax 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体查看下ajax是否返回div数据成功 ajax 回调函数中$('#d_content').find('#指定id').... ajax返回的数据已经显示出来了,还有那个find()函数我也用了 ,都不行,对了,忘记说了一点,Ajax返回的值是在jquery的html()里面的,变成innerHTML也还取不到代码不能外漏啊 ,真抱歉 $("#sel_list").change(function(){ $.get("/shop/showphotos", {album_id:$("#sel_list").val()}, function(dt){ document.getElementById("d_content").innerHTML = dt; },"html"); }); $("#sel_list").change(function(){ $.get("/shop/showphotos", {album_id:$("#sel_list").val()}, function(dt) { $('#d_content').html(dt); $('#d_content').find('...').css(...); },"html");}); 相对完整的测试例<?phpif($_POST) { exit('<div id=p>aaa</div><div id=p1>bbb</div>');}?><script src=scripts/jquery-1.8.3.min.js></script><script>$(function() { $.post('<?=$_SERVER['PHP_SELF'];?>', {id:1}, function(d) { $('#view').html(d).find('#p').css('color', '#f00'); });})</script><div id=view></div> 还是不行,我想要鼠标悬浮的样式 按你的办法走了 还是没反映,就取不到那个ID JS文件路径什么的肯定对 因为这个JS文件里还有别的 ,都可以,就这个取不到 这个就是真实的AJAX代码,还有,我想取的是ID下的一个Class 真的很谢谢你。我在firebug里看到那些AJAX返回的代码了 ,都没问题。 <div id="d_content" style="width:500px;height:270px;margin-top:5px;overflow:auto;"></div> 这是phtml代码的,用的Zend框架 返回的数据都在这里面 <div id="d_content" style="width:500px;height:270px;margin-top:5px;overflow:auto;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"> <div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;"></div>这是firebug下看到的返回的数据 就取那个 class="pic_box1" $('.pic_box1') 得到的是一个数组。你还需要在each 中单独处理,当然整体设置也是可以的 麻烦你帮我解决下好吗,我不知道那个each怎么用的 对了,我之前用的就是这个代码,$()按你说的取的也是一个数组,但是没有each处理也能出效果,那些数据是在HTML页面的,这个是因为现在这些数据是AJAX返回的么? 现在这个AJAX返回的是 一些图片,这些图片由DIV包着,设margin:5px;我就想设置鼠标放在这些图片上的时候,有那种选中的效果,比如让DIV的border显示并且加个背景颜色 解决了,方法是对的,但是我忽略 ajax的同步异步请求了,这个东西在这需要同步一下的 php大侠们可以帮忙看看嘛?我是新手啊 跪谢啊 debian下的php扩展so怎么也认不出来,请高人帮忙解答! 求一个php+mysql的简单文章/新闻/博客系统 请问有哪些流行的功能强大的CMS建站系统?(php+MySql)类 谁帮我写个DEDE问答的伪静态规则? PHP入门级问题 discuz 伪静态设置以及改/forum.php为/forum/ move_loaded_file()上传文件名乱码问题如何解决?高手指导一下 我的网站被挂马了 怎么清除呢? thinkphp volist 用法报错;刚学tp框架不久。求大腿 尚德胶带分析汽车线束胶带市场前景 php解析jsp页面
$('#d_content').find('#指定id')....
$.get("/shop/showphotos", {album_id:$("#sel_list").val()}, function(dt){
document.getElementById("d_content").innerHTML = dt;
},"html"); });
$.get("/shop/showphotos", {album_id:$("#sel_list").val()}, function(dt) {
$('#d_content').html(dt);
$('#d_content').find('...').css(...);
},"html");
});
if($_POST) {
exit('<div id=p>aaa</div><div id=p1>bbb</div>');
}
?>
<script src=scripts/jquery-1.8.3.min.js></script>
<script>
$(function() {
$.post('<?=$_SERVER['PHP_SELF'];?>', {id:1}, function(d) {
$('#view').html(d).find('#p').css('color', '#f00');
});
})
</script>
<div id=view></div>
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
<div class="pic_box1" style="width:140px;height:100px;margin:9px;float:left;border:1px #ffffff solid;">
</div>这是firebug下看到的返回的数据 就取那个 class="pic_box1"
你还需要在each 中单独处理,当然整体设置也是可以的