jQuery的ajax和get方法的默认dataType是什么? [英] What's default dataType of jquery's ajax and get methods?

查看:984
本文介绍了jQuery的ajax和get方法的默认dataType是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道$.ajax()$.get()的dataType的默认值吗? 是 json 还是 html 或其他?

I need to know the default value of dataType of $.ajax() and $.get()? It's json or html or others?

推荐答案

文档:

数据类型(默认值:Intelligent Guess (xml, json, script, or html))

期望从服务器返回的数据类型.如果未指定,则jQuery将尝试根据响应的MIME类型来推断它(XML MIME类型将产生XML,在1.4中,JSON将产生JavaScript对象,在1.4脚本中,脚本将执行该脚本,而其他所有内容将是返回为字符串).

The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string).

这篇关于jQuery的ajax和get方法的默认dataType是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆