i want to pass this paramater topic
to another page,
p.s. the page is loaded using jquery?
the url:
http://localhost/final/home.php#page2?topic=jquery
now, i want to echo the the topic on #page2
<h3 class="timeline"><?php echo $_GET["topic"]; ?> </h3>
but it deosnt echo, any solutions, sorry for the newbiw questions :))
load_page.php
<?php
if(!$_POST['page']) die("0");
$page = (int)$_POST['page'];
if(file_exists('pages/page_'.$page.'.php'))
include('pages/page_'.$page.'.php'); // i.e page_2.php
else echo 'There is no such page!';
?>
Your URL needs to be like this:
http://localhost/final/home.php?topic=jquery#page2
Anything after the hash (#
) isn't sent by the browser, it's purely for the browser, e.g. scrolling to the correct location, a way to do AJAX history, etc...but it's not sent in the request, currently all your server is getting is:
http://localhost/final/home.php
Which explains why _GET["topic"]
is empty.
remove the php from dataType, and read this read this about datatypes for ajax requests
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With