I would like to send POST data using an html tag.
I know that there is no way doing this unless i script.
However i tried , but couldn't get it to work.
<a class="test" onClick="assign()"><img src='<?php echo $accounts[$i]['Account']['image']; ?>' /> <?php echo $accounts[$i]['Account']['screen_name']; ?></a>
I tried using this:
function assign(){
$.post("/Accounts/index",
{ data: "test"
});
}
and i also tried this :
$(document).ready(function(){
$(".test").click(function(){
$.post("/accounts/index",
{ data: "test"
});
});
});
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…