在一个服务器发送与体内的HTML文档的HTTP响应,它通常会使用的text / html
的内容类型。如果内容类型是不同的,如果效应初探是HTML片段?
When a server sends an HTTP response with an HTML document in the body, it would usually use the text/html
content type. Should the content type be different if the reponse is a fragment of HTML?
例如,如果请求是AJAX从客户端脚本和整个响应的身体< DIV>< P>新建文字< / P>< / DIV>
那么响应不是HTML文档。如果应用程序设置的内容类型以外的其他的text / html
这样的片段?如果有,是什么?
For example, if the request is AJAX from a client script and the entire response body is <div><p>New text</p></div>
then the response is not an HTML document. Should the application set the content type to something other than text/html
for such fragments? If so, what?
这是一个个人的preference。如果只是你的应用程序,那么也没关系。我想保持它的text / html
,因为它仍然是HTML标记,即使不是一个完整的文档。
It's a personal preference. If it is only your app, then it doesn't matter. I would keep it text/html
because it is still HTML markup, even if not a complete document.