3

I managed to use jEditable selects, inputs and textareas quite easily, but I have problems with uploading files :

I can't manage to send $_POST values along with the $_FILES values, and no extra data is passed through submitdata...

Here is my code :

$(".photo").editable("class/save.php",
{
    indicator : "<img src='img/indicator.gif'>",
    type      : 'ajaxupload',
    submit    : 'Envoyer',
    cancel    : 'Annuler',
    tooltip   : "Cliquer pour modifier...",
    submitdata : {row: "photo"}
});

When I do a print_r($GLOBALS);, $_GET and $_POST arrays are empty...

Did I miss something ?

Thank you

arnaud
  • 33
  • 6

2 Answers2

2

The jeditable.ajaxupload plugin does not submit the 'submitdata' setting's.

I did some modification to the plugin to include submitdata and also the element's id in the submission (through querystring). You have to use $_GET to get the extra data.

Here is the link : https://github.com/tuupola/jquery_jeditable/pull/38/files

Alyasa'
  • 36
  • 2
  • I am trying to use this plugin but not able to send the ID of the element to the backend script like the jeditable utility sends. how can i send the ID of the element? pl advice – rajeev Nov 05 '12 at 04:09
  • Many thanks, it works. @rajeev : The id is send in $_GET['id'] with this solution – Reign.85 Apr 20 '15 at 17:10
1

or you could just set the

$.ajaxFileUpload({
            url: settings.target,
            secureuri:false,

            /// Add the following line
            data    : settings.submitdata,


            fileElementId: 'upload',
            dataType: 'html',
            success: function (data, status) {
                alert(data);
                $(original).html(data);
                original.editing = false;
            },
            error: function (data, status, e) {
                alert(e);
            }
        });
DaveShaw
  • 52,123
  • 16
  • 112
  • 141