$('#submitThisId').click(function() { $.post("postTo.php", { id: $(this).attr('id') }, function(response) { alert(response); }); });
This will send your identifier to postTo.php and can be restored using: $id = $_POST['id'];
No matter which postTo.php file is returned, a warning will be displayed on the screen (response).
EDIT: In order to send to the same page and perform some server-side actions (db request, etc.), you will need to place something similar to the following code at the top of the page:
<?php if (isset($_POST['id'])) { $id = $_POST['id'];
When this βresponseβ (text, html, etc.) returns to jQuery, you can use simple jQuery to insert it on the page where necessary and change the appearance of the page.
source share