Carlos Perez
Carlos Perez

Reputation: 435

Ajax loading data from a different file

Can someone tell me why this is not working

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

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

<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>

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.

Upvotes: 0

Views: 50

Answers (1)

Musa
Musa

Reputation: 97672

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

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

Upvotes: 2

Related Questions