bubbles Posted May 31, 2013 Report Share Posted May 31, 2013 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. Quote Link to comment Share on other sites More sharing options...
TheTime Posted May 31, 2013 Report Share Posted May 31, 2013 Ai inclus jquery? Ce browser folosesti? Uita-te in consola javascript si spune ce scrie pe acolo dupa ce dai click. 1 Quote Link to comment Share on other sites More sharing options...
bubbles Posted May 31, 2013 Author Report Share Posted May 31, 2013 Greseala mea, am rezolvat. Mai aveam un javascript care intra oarecum in conflict cu ce am postat. Quote Link to comment Share on other sites More sharing options...