-1
$.ajax({
        url: 'index.php?route=account/edit',
        type: 'post',
        data: $('#account_edit input[type=\'text\'], #account_edit input[type=\'password\'],**#account_edit input[type=\'file\']**,#account_edit input[type=\'radio\']:checked'),
        dataType: 'json',
        beforeSend: function() {
            $('#button-update').attr('disabled', true);
            $('#button-update').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
        },  
        complete: function() {
            $('#button-update').attr('disabled', false); 
            $('.wait').remove();
        },          
        success: function(json) {
            $('.warning').remove();
            $('.error').remove();
            //alert(json['error']['firstname']);

            if (json['redirect']) {
                //location = json['redirect'];
            }

}
zb'
  • 8,071
  • 4
  • 41
  • 68

2 Answers2

0

I have used the jQuery form plugin to submit files in an ajax-like manner, specifically the .ajaxSubmit() method.

Joe Day
  • 6,965
  • 4
  • 25
  • 26
0

$.ajax() does not support file uploading. Better you should try some plugins like ajaxForm to upload files.

JOE
  • 489
  • 4
  • 7
  • 16