Viperium Viperium - 1 month ago 14
Ajax Question

Plupload Ajax sending POST information Jquery - CodeIgniter

I am trying to store the information about uploaded images and videos to the database. I am using PLupload custom script to upload the files. The upload proces is working well with custom filenames. Jquery is loaded as well as the plupload scripts.

In the FileUploaded section I am trying to use a Jquery $.ajax or $.post to send the data to the controller.

FileUploaded: function(upldr, file, object, ordernumber, orderitem) {
$.ajax({
type: "POST",
url: "controller.php",
data: {
file: file,
ordernumber: ordernumber,
orderitem: orderitem
},
success: function(results){
document.getElementById('console').innerHTML += "[ Stored in database ]";
},
dataType: "json"
});

},


But I am getting a strange error: Uncaught TypeError: this.getSource is not a function in plupload.full.min.js. I have searched for hours now on Stackoverflow and Google but wasn't able to find a answer.

I hope that I can find the answers here. I tried $.post as well without success. Any other suggestions to parse the information to the controller?

Answer

Try to use the post function of jQuery

$.post( "controller.php", { file: file, ordernumber: ordernumber, orderitem: orderitem })
  .done(function( data ) {
    document.getElementById('console').innerHTML += "[ Stored in database ]";
  });