Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:49:54+00:00 2026-05-27T06:49:54+00:00

i save data in a data base with json/jquery/ajax. When i load the data

  • 0

i save data in a data base with json/jquery/ajax.
When i load the data in a textarea i get the result which i want to have.
But when i load the data in a DIV, then there are no line breaks.
I tested everything with css including

white-space:pre;

etc.

I’m saving the data in json with

"', 'text': '" + $('#textInput').val() +

but I’ve also tested it with .html() and .text().

Reading the data:

$('#textOutput').text(data.d.Text);

I’m getting the corect text in my div, but there are no line breaks!

CSS of textOutput

.textOutput // <div> not working, <textarea> working
{
width:100%;
border: 0;
height: auto;
overflow:visible; // also tested with auto etc.
margin: 5px 8px 5px 0px;
font-family: Courier New, Courier;
font-size: 12px;
// white-space:pre;
}

CSS of input is equivalent

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:49:55+00:00Added an answer on May 27, 2026 at 6:49 am

    If you are using PHP, you have to do a nl2br() call to change the \n\r to a <br /> tag. You can also do this in Javascript by data.d.Text.replace(/\n/g, "<br />");

    For ASP you can use .Replace("\n", "<br />").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following data which I want to save in my DB (this
I am using jquery and json to save data to the database. How can
I have following data to save in database using php my data is :
I am trying to save data to a database on a button push, but
I have a jquery Ajax call function that I use to submit form to
I want to access the Facebook Graph API and get JSON responses like this:
I have an application in which I am posting data to my server API
i have to send form data which have multiselect boxes to a servlet using
Maybe i get minuses for this question, but i have problems with success and
I have a jquery script that collects data from different sites and saves it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.