Send FormData and String Data Together Through JQuery AJAX -
i have below uploads image using jquery's ajax function
var id = <?php echo $id; ?>; var img_data = new formdata($("form")[0]); $.ajax({ url: 'add.php', data: img_data, contenttype: false, processdata: false, type: 'post', success: function(data){ alert(data); } });
i'd include string formdata sent. tried following, no luck
data: img_data {id: id},
what's correct syntax here?
use append
var img_data = new formdata($("form")[0]); img_data.append('id', id);
Comments
Post a Comment