更新时间:2023-12-05 18:38:16
这取决于您在AJAX调用中设置的dataType
选项.如果将其设置为html
,它将以纯文本的形式返回HTML,并带有准备插入DOM的脚本标签.如果将其设置为script
,则jQuery将尝试运行脚本并将结果作为纯文本字符串返回.
It will depend on the dataType
option you set in your AJAX call. If you set it to html
it will give you back the HTML as plain text with the script tags ready for insertion to the DOM. If it is set to script
then jQuery will attempt to run the script and return the result as a plain text string.
如果您未设置dataType
,则jQuery将自动从响应MIME类型中推断出该类型.
If you are not setting a dataType
then jQuery will automatically infer the type from the response MIME type.
看看jQuery文档( http://api.jquery.com/jQuery.ajax/ )以获取有关dataType
设置的更多信息.
Have a look at the jQuery docs ( http://api.jquery.com/jQuery.ajax/ ) for more info on the dataType
setting.