另一方面接受使用文字对象来定义mime-types.(从 this判断).就像是:
$.ajax({ url: ... dataType: 'json',accepts: { xml: 'text/xml',text: 'text/plain' } });
内容类型适用于
When sending data to the server,use this content type.
来自jQuery文档.
如果有人可以帮助解决这个问题会很棒.谢谢.
考试问题:
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
by using binary format if possible ? Retrieve and parse the data from
the web service by using XML when binary format is not possibleYou need to develop the application to meet the requirements. What
should you do? (To answer,drag the appropriate code segment to the
correct location. Each code segment may be used once,more than once,
or not at all. You may need to drag the split bar between panes or
scroll to view content.)
码:
var request = $.ajax({ uri: '/',
选项1:接受:’application / bint,text / xml’,
选项2:contentType:’application / bint,text / xml’
选项3:dataType:’application / bint,text / xml’
dataFilter: function(data,type) {
选项1:if(request.getResponseHeader(“Content-Type”==’application / bint’)
选项2:if(type ==’application / bint’)
选项3:if(request.mimeType ==’application / bint’)
},success: function(data) { start(data); } });
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。