Jump to content
bubbles

Javascript Submit

Recommended Posts

Am asa :


<div class="movie" id="result_1" data-source="dasdd33">
bla bla
</div>
<div class="movie" id="result_2" data-source="312dfsfsd">
bla bla
</div>
<div class="movie" id="result_3" data-source="fsd23fdfsdf">
bla bla
</div>
<div class="movie" id="result_4" data-source="fsf23f44f">
bla bla
</div>


<script>
$('document').ready(function(){
$('.movie').click(function(){

var source = $(this).attr('data-source');

$.ajax({
url: "test.php",
type: "POST",
data: {
source: source,
},
success: function(data) {
alert(data);
}

});
return false;

});
});

</script>

Ce nu am scris bine ? Vreau sa se faca $_POST['source'] cand dau click pe div, iar variabila sa fie in functie de div-ul pe care dau click.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...