ajaxAnywhere.getAJAX() 方法的一点心得

近来用ajaxAnywhere.getAJAX(url),发现了一个小问题,就是第一次触发时,不会刷新相应的区域;尝试了好几次,发现ajaxAnywhere.getAJAX(url, zonesToRefres)这个API,把对应的zone设置为第二个参数,就能如愿以偿了。

 

本人用到的代码参考如下,给初学者一个参考:

这部分代码实现的功能很简单,就是弹出一个div窗口,显示相关内容。

 

css部分:

<style>
.white_content {
display: none;
position: absolute;
top: 35%;
left: 30%;
width: 120%;
height: 40%;
padding: 5px;
border: 5px solid orange;
background-color: white;
z-index:1002;
overflow: auto;
}
</style>

 

js部分:

<script>

  function showRates() {
    var num = document.getElementById('numperroom').value;
    var housetype = document.getElementById('order.housetype').value;
    var rateCode = document.getElementById('ratecode').value;
    var startDate = document.getElementById('sdate').value;
    var endDate = document.getElementById('edate').value;

    ajaxAnywhere.getAJAX('<s:url action="toSelectRate"/>?num='+num + '&housetype=' + housetype + '&rateCode=' + rateCode + '&startDate=' + startDate + '&endDate=' + endDate, 'rateListzone');

    ajaxAnywhere.getZonesToReload = function () {
      return 'rateListzone';
    };
    ajaxAnywhere.onAfterResponseProcessing=afterGetRatesResponse;
  }
 
  function afterGetRatesResponse() {
    document.getElementById('light').style.display='block';
  }
</script>

 

 

页面部分代码:

   <s:a href="#" οnclick= "showRates();"><font color="red">当前租金:</font></s:a>
     <aa:zone name="rateListzone">
       <div id="light" class="white_content">
          <table width="100%">
             <tr align="right">
               <td align="left"><font color="red">显示在住期间租金</font></td>
               <td align="right">
                   <img src="images/close_1.jpg" alt="关闭窗口" align="right" width="17" height="17" style="cursor:hand;"  onClick="document.getElementById('light').style.display='none';">
                </td>
              </tr>
            </table>
            <table bgcolor="#B1D2FB">
              <tr>
                <td>星期日</td>
                <td>星期一</td>
                <td>星期二</td>
                <td>星期三</td>
                <td>星期四</td>
                <td>星期五</td>
                <td>星期六</td>
              </tr>
              <s:iterator value="ratePerWeekList">
                       <tr>
                         <td bgcolor="#FFFFFF"><s:property value="Sun"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Mon"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Tue"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Wed"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Thu"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Fri"/></td>
                         <td bgcolor="#FFFFFF"><s:property value="Sat"/></td>
                       </tr>
              </s:iterator>
             </table>
           </div>
           </aa:zone>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值