Changing costs content without reloading page
-
Hey!
I am new here, I will be very grateful for your help in getting the subject.
I want to be able to change the content in a given place (div) based on the listed posts (title / thumbnail) without reloading the page.I have found such a tutorial (which is my dream come true solution), but it did not work -> like author did not finished one line of code or something?
How to dynamically load posts on click using Ajax in Genesis
Another solution I found (and it worked, but on a regular static page, not inside a wordpress my own template) is the following code (it refers to js from google):
<DOCTYPE html> <html> <head> https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js <script> $(document).ready(function(){ // Set trigger and container variables var trigger = $('#nav ul li a'), container = $('#content'); // Fire on click trigger.on('click', function(){ // Set $this for re-use. Set target from data attribute var $this = $(this), target = $this.data('target'); // Load target page into container container.load(target + '.php'); // Stop normal link behavior return false; }); }); </script> </head> <body> <nav id="nav"> <ul> <li><a href="#" data-target="home">Home</a></li> <li><a href="#" data-target="about">About</a></li> </ul> </nav> <div id="content"> <?php include('home.php'); ?> </div> </body> </html>I will be very grateful for any help!
The blog I need help with is: (visible only to logged in users)
-
Hi there,
Can you please let me know your site’s address so I can point you in the right direction of getting support?
Please note that these forums are for WordPress.com hosted sites only. If your site is using the open-source WordPress.org software you need to seek help at these forums:
- The topic ‘Changing costs content without reloading page’ is closed to new replies.