0

I have a div that load an external page.

index.php

<div class="loadWow"></div>

<script>
    $(document).ready(function(){
       $(".loadWow").load("external.php");
    });

    $(".newLink").click(function(){
       var link = $(this).attr('rev');
       $(".loadWow").load(link);
    });

</script>

external.php

<a href="javascript:void(0);" class="newLink" rev="other.php">Load Another Page</a>

As you can see, loadWow DIV will load external.php.
My question is, how can i change the loaded page on the loadWow by clicking the link from an external page (external.php).

Thank you in advance.

Cœur
  • 37,241
  • 25
  • 195
  • 267
brianlasta
  • 304
  • 2
  • 7

1 Answers1

0

If I understand well, what you want is when you have loaded your new page (external.php) you can click on link on this new page and then reload the div. If I guess right, you need to use this code:

$(document).on('click', '.newLink', function(){
       var link = $(this).attr('rev');
       $(".loadWow").load(link);
}

If you give directly the newLink class as reference, jQuery won't find your class because it's not loaded in the DOM.

GRosay
  • 444
  • 10
  • 26
  • It works!! Thank you very much for your explanation, i find it difficult to find the right keyword while googling. Thank you very much sir. :D – brianlasta Aug 29 '14 at 11:19