Not sure what I’m missing, the value won’t post. I would like the code to post to the current page (test.php)
<script>
$(document).ready(function(){
$("#submit_response").click(function() {
$.post(test.php, {name: 'demo'}, success: function(data) {
});
});
});
</script>
<a href="#" id="submit_response" data-role="button" data-theme="a">Demo Save</a>
<?php if(isset($_POST['name'])) echo 'Posted: '.$_POST['name'];?>
Note that your content would’nt be updated with
<?php if(isset($_POST['name'])) echo 'Posted: '.$_POST['name'];?>To make it work you can do like this :
1st create a function called
update()or everything you want in bottom of all your html after any contentUPDATE FUNCTION :
AND CALL IT BEFORE ALL YOUR HTML OR ANY CONTENT
<?php update(); ?>Then your javascript to update your page :