Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][PHP]Przekazanie tablicy z JQuery do PHP
KRISPI
post
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 22.11.2011

Ostrzeżenie: (0%)
-----


Witam mam problem z przekazaniem tablicy do kodu PHP. Napiasałem skrypt JQUERY:
  1. <script type="text/javascript">
  2.  
  3.  
  4. $(document).ready(function(){
  5. $("td.komorka").click(function() {
  6. if($(this).css('background-color')== 'white')
  7. {
  8. $(this).css('background-color','red');
  9. }
  10. else if($(this).css('background-color')== 'red')
  11. {
  12. $(this).css('background-color','orange');
  13. }
  14. else
  15. {
  16. $(this).css('background-color','white');
  17.  
  18. }
  19. })
  20. $('td.komorka').each(function(){
  21. var tablica = [];
  22. var id,nr;
  23. if($(this).css('background-color')== 'white')
  24. {
  25. id=$(this).attr('id');
  26. nr=parseInt(id);
  27. tablica[nr]== 0;
  28. }
  29. else if($(this).css('background-color')== 'red')
  30. {
  31. id=$(this).attr('id');
  32. nr=parseInt(id);
  33. tablica[nr]== 1;
  34.  
  35. }
  36. else if($(this).css('background-color')== 'orange')
  37. {
  38. id=$(this).attr('id');
  39. nr=parseInt(id);
  40. tablica[nr]== 2;
  41.  
  42. }
  43.  
  44. $.post('rezultat.php',{tab:tablica},function(data){})
  45.  
  46. )
  47.  
  48. })
  49. });
  50.  

I teraz chciałbym odebrać zmienną tablica[] w PHP.Robię to w ten sposób ale nie działa:
  1. $tab=$_POST['tab[]'];
  2. for($i=0;$i<230;$i++)
  3. {
  4. echo "$tab[i]";
  5. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 07:07