v2.5.2
Giriş yap

ajax dosya yükleme + veri gönderme

burak001
759 defa görüntülendi
$.ajax({
    url:"pages/listele.php",
    data: new FormData(this),
    type:"POST",
    contentType: false,
    processData:false,
    cache:false,
    success:function(e){
     alert(e);
    }
});

ajax ile şöyle dosya yülemek için php dosyama veri gönderiyorum fakat bununla beraber ek olarak
html verisi nasıl gönderirim

html verim şöyle

var icerik = $(".rich_txt").html()
trsherlock
1158 gün önce

Aşağıdaki kodları bir excel dosyasını php ile okutmak için kullanıyorum. Deneyebilir misin?

$('#excelFile').prop('files')[0] tam emin değilim ama çoklu göndereceksen sonundaki [0] kodunu kaldırman gerekebilir.

<input id="excelFile" type="file" />
$('#excelFile').change(function () {
    var file_data = $('#excelFile').prop('files')[0];
    var form_data = new FormData();
    form_data.append('excelFile', file_data);
    
    $.ajax({
        url: 'excel_to_html_table.php', // point to server-side PHP script 
        dataType: 'json',  // what to expect back from the PHP script, if anything
        cache: false,
        contentType: false,
        processData: false,
        data: form_data,
        type: 'post',
        
        success: function (dizi) {
        
        }
    });
})