I want to fake a page submit (post) on clicking a link. I need to pass two parameters in the post , the id (var “x” in the code below, and submitted=”true”) to the page index.php. I need to fake a submit (full page load) and not just an ajax request.
<a href="#" id="5" class="rootcontent">Title</a>
$("a.rootcontent").live('click', function(){
var x= $(this).attr("id");
//need the code to submit the page to index.php with two $_POST variables (x and submitted=true)
});
A quick solution would be to append a form to the document and submit it. Something like the following (not tested, but it should work):