简体   繁体   中英

I am trying to create a link in a .php file to another .php file

Please help!

So firstly I have a 'gigs' page on my website (www.lydiaglanville.com) and I wanted to separate the gigs into an 'upcoming' section and an 'archive' section to make it look neater. The person who designed my site did this thing on my 'about' page so I copied the code. But for some reason it all works fine but nothing happens when I click the link for the archive.

Here is the code. Can anyone see what I'm doing wrong?

They are 3 separate documents entitled 'gigs.php' which opens first and links to the others, 'upcoming.php' and 'archive.php'

Any help is greatly appreciated!

gigs.php

<div id="gigs">
<!-- jQuery AJAX load biog on doc ready 

-->
<script type="text/javascript">
$(document).ready

(function(){
   $('#gigs').load('upcoming.php');


});
</script>
</div> 

upcoming.php

<?php
define('WP_USE_THEMES', false);
require('admin/wp-

blog-header.php');
?>

<h3><a href="#" 

onclick="ajax_gigs_request();$('#gigs').load

('upcoming.php');">Upcoming</a> | <a href="#" 

onclick="ajax_gigs_request();$('#gigs').load

('archive.php');">Archive</a></h3>
<h1>Upcoming</h1>
<div 

id="upcoming">

<?php
$page_id = 612;
$page_data = get_page( 

$page_id );
$content = $page_data->post_content; // 

Get Content
echo apply_filters('the_content', 

$content);
?>
</div> 

archive.php

<?php
define('WP_USE_THEMES', false);
require('admin/wp-blog-header.php');
?>

<h3><a href="#"             onclick="ajax_gigs_request();$('#gigs').load('upcoming.php');">Upcoming</a> | <a href="#"         onclick="ajax_gigs_request();$('#gigs').load('archive.php');">Archive</a></h3>
<h1>Archive</h1>
< div id="archive">
<h4>Archive:</h4>
<?php
$page_id = 603;
$page_data = get_page( $page_id );
$content = $page_data->post_content; // Get Content
echo apply_filters('the_content', $content);
?>

</div>

no ; as there is only the option for one statement

The solution can be:

onclick = "ajax_gigs_request(){ $('#gigs').load('upcoming.php'); }"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM