I have a typical ajax call like so:
$.ajax({
method: "GET",
url: "something.php?",
data: data,
success: function(data){
//something//
}
});
There is nothing wrong with this code. Now, corresponding with this is my something.php
, which is like so:
<?php
print("<p>Something</p>");
?>
My PHP subsequently returns <p>Something</p>
, p tags and all. I would like to know what I should be doing for the ajax response to return with html formatting so that it recognizes the p tags.
EDIT: The problem here isn't about outputting random text. My something.php
is meant to print data. Thus, it has to come from the PHP url route. I am having trouble understanding how to output html tags alongside php data. like echo <p>$something</p>
Currently, this would return precisely <p>\\data here</p>
with the p tags.