Я могу создать конвертер для моего собственного типа MIME:
$.ajax( url, {
accepts: { dload: 'application/x-dload' },
contents: { dload: /dload/ },
converters: {
"text dload": jQuery.parseJSON,
},
dataType: 'dload',
success: function( data, status, xhr ){
... data is of dload type
},
})
Но возможно ли предоставить конвертеры для моего MIME-типа, когда ответ не текстовый?например, xml или html?
Это не работает:
$.ajax( url, {
accepts: { dload: 'application/x-dload' },
contents: { dload: /dload/ },
converters: {
"text dload": jQuery.parseJSON,
"xml dload": convert_xml_to_dload,
"html dload": convert_html_to_dload,
},
dataType: 'dload',
success: function( data, status, xhr ){
... data is of dload type
},
})