exam questions

Exam 70-480 All Questions

View all questions & answers for the 70-480 exam

Exam 70-480 topic 1 question 8 discussion

Actual exam question from Microsoft's 70-480
Question #: 8
Topic #: 1
[All 70-480 Questions]

HOTSPOT -
You are developing a web application that retrieves data from a web service. The data being retrieved is a custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
✑ Retrieve and parse data from the web service using binary format if possible
✑ Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, select the appropriate options from the drop-down lists in the answer area.)
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
* accepts : 'application/bint, text/xml'
accepts:'application/bin,text/xml' to accept only XML and binary content in HTML responses.
* Use the following condition to check if the html response content is binary: If(request.getResponseHeader("Content-Type")=="application/bint"
* var request = $.ajax({
uri:'/',
accepts: 'application/bint, text/xml',
datafilter: function(data,type){
if(request.getResponseHeader("Content-Type")=="application/bint") return parseBint(data); else return parseXml();
},
success: function (data) {
start(data);
}
});

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
northgaterebel
4 years, 3 months ago
Both answers seem correct but the documentation is scattered and a bit thin. https://api.jquery.com/jquery.ajax/ https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getResponseHeader
upvoted 1 times
...
WebSavant
5 years, 2 months ago
accepts property needs an object as a value
upvoted 2 times
...
rosdra
5 years, 2 months ago
Was thinking that if (type == 'application/bint') is also correct for the second answer, based on dataFilter doc. here: https://api.jquery.com/jquery.ajax/ anyone has a clearer insight of which one is correct for second answer?
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago