Ajax从不同的文件加载数据 [英] Ajax loading data from a different file

查看:107
本文介绍了Ajax从不同的文件加载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我为什么这不工作

Can someone tell me why this is not working

<script>
$(document).ready(function() {
  $("#driver").ready(function(event){
    $('#stage').load('index.php');
  }); 
});
</script>

我在index.php上有一个链接表,问题是真的很难点击其中一个链接,我必须点击10次才能使它工作,任何想法为什么?

What I have on the index.php is a table with link, the problem is that is really hard to click on one of those link, I have to click like 10 times to make it to work, any ideas why?

Index.php

Index.php

<script>
$(document).ready(function() {
    $('#stage').load('index.php');
});
</script>
<table width="200" border="1">
  <tr>
    <td>Name </td>
    <td>URL Address</td> 
  </tr>
  <tr>
    <td><a href="https://www.google.com/">Googe</a></td> 
    <td><a href="https://www.google.com/">Google</a></td>
  </tr> 
</table>

我在index.php中包含相同的函数,

I include the same function on my index.php, the idea is if a make a change on the index page, and reflect the change on the test page.

推荐答案

就绪事件只在文档上触发,删除 $(#driver)。ready( part。

The ready event is only triggered on the document, remove the $("#driver").ready( part.

$(document).ready(function() {
    $('#stage').load('index.php');
});

这篇关于Ajax从不同的文件加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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