Подскажу
$.ajax(
'/url/to_script',
{
type: 'post',
dataType: 'json',
sucsess: function(response)
{
var result = response;
var txt = '';
txt += 'Done.<br/>';
txt += 'Processed: ' + result.processed + '<br/>';
txt += 'Added: ' + result.added + '<br/>';
txt += 'Failed: ' + result.failed + '<br/>';
txt += 'Duplicated: ' + result.duplicated + '<br/>';
txt += 'Duplicated codes list: <i>' + result.duplicated_codes + '</i>';
Y$('generator_result').innerHTML = txt;
},
error: function()
{
Y$('generator_result').innerHTML = 'Upload failed! Error: ' + e;
}
});