Hi. I have a form with some fields ad the field for upload an image. Inside this form there is a table with some rows. My target is send all form informations to php.
- This is my code:
- $(document).ready(function(){
- var array_orari =[];
- $("#salva").click(function(){
-
- $('#orari tbody tr').each(function () {
-
- var giorno = $(this).find(".giorno").html();
- var apertura1 = $(this).find(".ap1").val();
- var chiusura1 = $(this).find(".ch1").val();
- var apertura2 = $(this).find(".ap2").val();
- var chiusura2 = $(this).find(".ch2").val();
-
- array_orari.push({giorno: giorno, apertura1:apertura1, chiusura1:chiusura1, apertura2:apertura2, chiusura2:chiusura2});
-
- });
-
- array_orari = JSON.stringify(array_orari);
-
-
-
- var formData = new FormData($('#data')[0]);
-
- formData.append('array_orari',array_orari);
-
- $.ajax({
- url: 'ristoDao.php',
- type: 'POST',
- dataType:'JSON',
- data: formData,
- success: function (data) {
- alert(data)
- }
- });
- });
- });
My problem is when try to send the data to php I have an error on ajax.
Uncaught TypeError: Illegal invocation
I cant't understand the error. Please help me.