Home jQuery Ajax - Show line breaks in response
Reply: 0

jQuery Ajax - Show line breaks in response

user719
1#
user719 Published in April 26, 2018, 1:46 pm

I am using this simple script to get the response using Ajax from a PHP file..

           $.ajax(
            {
                url: 'response.php',
                type: 'get',
                dataType:'text',
                success: function(data){
                    jQuery(".results").text(data);
                }
            }

<?php
   echo "1<br />";
   echo "2<br />";
   echo "3<br />";
   echo "4<br />";
   echo "5<br />";
   echo "6<br />";
   echo "7<br />";
   echo "8<br />";
?>

This works but does not show the line breaks, is there a way to get it so that jQuery shows it with the line breaks?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.479536 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO