mam taką funkcję:
function zapisz_dane_z_okna_dial(){ var dane_formularza=[]; dane_formularza['id_artykulu']=$("#okno_dialogowe").attr('id_artykulu'); dane_formularza['tytul']=$("#tytul ").val(); dane_formularza['podtytul']=$("#podtytul ").val(); dane_formularza['na_glownej']=$(".na_glownej ").prop('checked'); dane_formularza['dzial']=$(".dzial ").val(); dane_formularza['ikona']=$("#podglad_ikony").find('img').attr('src'); dane_formularza['tresc_artykulu']=$('#tresc_artykulu').find('iframe').contents().find('body').html(); dane_formularza['galeria']=[]; for(i=0;i<$('.podglad_zdjecia_galerii').length;i++){ dane_formularza['galeria'][i]=$('.podglad_zdjecia_galerii').eq(i).attr('src'); } $.ajax({ url: 'przyjmij_artykul.php', type: 'POST', cache: false, data: JSON.stringify(dane_formularza), dataType: 'json', processData: false, // Don't process the files contentType: false, // Set content type to false as jQuery will tell the server its a query string request success: function(data, textStatus, jqXHR) { alert(data); if(typeof data.errors === 'undefined') { // Success so call function to process the form } else { // Handle errors here console.log('ERRORS: ' + data.error); } }, error: function(jqXHR, textStatus, errorThrown) { // Handle errors here console.log('ERRORS: ' + textStatus); // STOP LOADING SPINNER } }); }
I teraz tak: Jeden z elementów tablicy asoscjacyjnej jest też tablicą o nie określonej z góry liczbie elementów.
czy jest jakaś funkcja i jaka to ewentualnie jest, która mi pomoże wsadzić tą tablice bezpośrednio do json-a? JSON.stringify daje wynik: [].
Ostatecznie napiszę sobie pętlę, ale może jest jakas fajna metoda na to.
Z góry dziękuję za pomoc.