YC.setForm(formObject, true);
var cObj = YC.asyncRequest(
'POST',
'/url/to_script',
{
upload: function(response) {
try {
var result = YJSON.parse(response.responseText);
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;
} catch (e) {
Y$('generator_result').innerHTML = 'Upload failed! Error: ' + e;
}
},
}
);
|