Image Upload and ajax "data" property

Image Upload and ajax "data" property

dmcglynndmcglynn Posts: 15Questions: 5Answers: 0
edited April 2018 in Editor

Hello,

I am using the ajax setup as follows for my editor:

jobEditor = new $.fn.dataTable.Editor( {
ajax: {
    url: '/ajax/table.bus_job.php',
    data: {
        SESSION_NAME: SESSION_NAME,
    }
},
...

Which works great.. any CREATE or EDIT actions submit my session_name variable along with everything else that editor submits via ajax.

However, with an image-field in my table, since the image is uploaded asynchronously, this variable isn't being submitted via ajax along with the file-data. Is there any way to make this happen?

( as a workaround, I've edited my ajax-file, and made it ignore this variable-check if I'm doing a file-upload, but I'd like to have it working )

Thanks,
David

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,722Questions: 1Answers: 10,108 Site admin
    Answer ✓

    Hi David,

    If you use:

    jobEditor = new $.fn.dataTable.Editor( {
    ajax: {
        url: '/ajax/table.bus_job.php',
        data: function ( d ) {
            d.SESSION_NAME = SESSION_NAME;
        }
    },
    ...
    

    i.e. ajax.data as a function, then the upload action will detect that and use the function just like Editor does. It looks like it doesn't currently detect ajax.data as an object - I'll look into that.

    Allan

This discussion has been closed.