Home > Web Front-end > JS Tutorial > body text

Solution to automatically add pre tag to ajax return value

亚连
Release: 2018-05-25 15:49:52
Original
2342 people have browsed it

The content returned by ajax actually automatically adds the pre tag. The solution is to modify the return type of the general handler. If you encounter a similar situation, you can refer to the following

ajax returns, automatically adds the pre tag

The content returned by ajax actually automatically adds the

 tag

In FF, IE, and Google Chrome, each return is different: ff lowercase, IE uppercase, Google plus style

After checking, it turns out that the returned type is wrong.

Final solution, modify the return type of the general handler

Modify

context.Response.ContentType = "text/plain";

to

context.Response.ContentType = "text/html";

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Detailed explanation of Ajax and form iframe methods to implement file upload

A brief analysis of the clever use of Ajax beforeSend Improve user experience

Quick solution for ajax transmission parameters containing special characters

The above is the detailed content of Solution to automatically add pre tag to ajax return value. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!