2
I’m trying to pass some data via Jquery to another php page.
I create the tag < a >
via echo
:
echo "<a id='".$feed_id."' class='like'> Teste LINK </a>";
• The $feed_id variable must return a numeric ID (ex: 1234)
I have the function:
$(document).ready(function(){
$("#like").click(function(){
var url = "like.php";
var data = $("#like").attr("id");
$.post(url,{postdata:data},
function(result) {
$("#result").html(result); // Só pra verificar retorno
});
});
And I try to get the value of the variable on the like.php page:
$data = $_POST['postdata'];
echo $data;
I need some tips to make this code work, and if possible, improve it.
And what’s the problem?
– Lucio Rubens