$_POST data on same page and output
Hello when a button is clicked I want to post data to the same page and show something.
Only there is nothing showing up.
My code:
- $(document).ready(function(){
$("#orderbycommonnameup").click(function(e){
e.preventDefault();
var url = document.location.href;
$.post(url,{orderby: "comnasc"},function(data){
window.location.reload();
});
})
- });
<a href="#" id="orderbycommonnameup"><img src="images/icon-arrow-up.png"></a>
and on the same page as the html I have:
- <?php
- if (isset($_POST['orderby'])) {
echo "YEAHH JQUERY POST WOIRKS";
}
- ?>
The echo is not showing :-(