$.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"> <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'];
}
}
Asked
Active
Viewed 668 times
-1

zb'
- 8,071
- 4
- 41
- 68

user1506085
- 1
- 1
-
please add some problem description. – ifixthat Aug 06 '12 at 12:24
-
http://stackoverflow.com/questions/10492617/how-can-i-upload-a-file-using-jquerys-ajax-function-with-json-and-php?rq=1 – zb' Aug 06 '12 at 12:27
2 Answers
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