I have this ajax code to send form data to a php file called upload.php
My Problem is: I can pass the form-data without any problem, but i i cannot pass another data with it. Everytime I do that, ajax is not pasing data to upload.php
Here's my ajax:
    function upload(fileid, imgno) {
                $(document).ready(function () {
                    var data = new FormData();
                    jQuery.each(jQuery('#' + fileid)[0].files, function (i, file) {
                        data.append('file-' + i, file);
                    });
                    $.ajax({
                        url: 'includes/upload.php',
                        dataType: 'text', // what to expect back from the PHP script, if anything
                        cache: false,
                        contentType: false,
                        processData: false,
                        data: {
                            data: data,
                            imgno: imgno
                        },
                        type: 'post',
                        success: function (php_script_response) {
                            alert(php_script_response); // display response from the PHP script, if any
                        }
                    });
                });
            }
and is is my upload.php
    if (isset($_FILES['file0'])) { //it doesn't pass this condition
      echo 'B';
    }
    $imageNO = $_POST['imgno']; //this gives undefined index.
How can I fix this problem?
 
     
     
    