“Ajax Upload Image” Code-Antworten

Ajax Upload Image

$(document).ready(function (e) {
    $('#imageUploadForm').on('submit',(function(e) {
        e.preventDefault();
        var formData = new FormData(this);

        $.ajax({
            type:'POST',
            url: $(this).attr('action'),
            data:formData,
            cache:false,
            contentType: false,
            processData: false,
            success:function(data){
                console.log("success");
                console.log(data);
            },
            error: function(data){
                console.log("error");
                console.log(data);
            }
        });
    }));

    $("#ImageBrowse").on("change", function() {
        $("#imageUploadForm").submit();
    });
});
Sparkling Seal

Ajax Formular Bild -Upload

$("#changeProfilePicForm").submit(function (e) {
    e.preventDefault();
    var $form = $(this);
    $.ajax({
        url: $form.attr('action'),
        type: "POST",
        data:  new FormData($form[0]),
        contentType: false,
        cache: false,
        processData: false,
        success: function (data) {
            console.log(data);
        },
        error: function(data){
            console.log(data);
        }           
    });
}));
Jittery Jaguar

Ähnliche Antworten wie “Ajax Upload Image”

Fragen ähnlich wie “Ajax Upload Image”

Weitere verwandte Antworten zu “Ajax Upload Image” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen