I came across this question in an exam. Can someone help with this. In my research, I found that dataType is something like "json" or "xml", and not the exact type of mime. Accepts in another manual use a literal object for defining mime types (judging by this ). Sort of:
$.ajax({ url: ... dataType: 'json', accepts: { xml: 'text/xml', text: 'text/plain' } });
And the type of content for
When sending data to the server, use this type of content.
from jQuery documentation.
If anyone can help with this, this will be great. Thanks.
Exam Question:
You are developing a web application that extracts data from the Internet providing services. The received data is its own binary data type with the name bandage. Data can also be represented in XML. The two existing methods named parseXml () and parseBint () are defined on the page.
The application should :? Getting and analyzing data from a web service using a binary format, if possible? Extract and parse data from a web service using XML when a binary format is not possible
You need to develop an application to meet the requirements. What should you do? (To answer, drag the corresponding code segment to the correct location. Each code segment can be used once, more than once, or not at all. You may need to drag the separation bar between the panels or scroll to view the contents.)
the code:
var request = $.ajax({ uri: '/',
option 1: accepts: 'application/bint, text/xml',
option 2: contentType: 'application/bint, text/xml'
option 3: dataType: 'application/bint, text/xml'
dataFilter: function(data, type) {
option 1: if(request.getResponseHeader("Content-Type" == 'application/bint')
option 2: if(type == 'application/bint')
option 3: if(request.mimeType == 'application/bint')
}, success: function(data) { start(data); } });