一般都是a页面向b页面传值 但我现在需要在a页面中获取b页面中特定区域的值 该怎么做呢?谢谢!a.html<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
   
          $.ajax({
    type:"post",
    url:'b.html',
    data:'',
cache:false,
success:function(e){alert(e)}
})
  
})
</script>
<title>无标题文档</title>
</head>
<body>
</body>
</html>b.html<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
   
          var v=$("#test").text();
 
})
</script>
<title>无标题文档</title>
</head>
<body>
<div id="test">xxx</div>
</body>
</html>

解决方案 »

  1.   

    当客户打开a页面时 异步调用b页面呀 只是不知道如何获取b页面特定区域的值
      

  2.   

    纯粹地解决问题,不考虑其他
    $.ajax({
    type: "post",
    url: 'b.html',
    dataType: 'html',
    cache: false,
    success: function (result) {
    var $result = $('<div></div>').hide();
    $result.html(result);
    alert($result.text());
    },
    error: function () {
    alert('error');
    }
    });
      

  3.   

    约定dataType为'html',写到最简,success里只有一句
    alert($('<div></div>').html(result).text());
      

  4.   

    显示b页面 里面table 的内容。
    $('#a页面的显示区域').load('b页面地址 table');