So I have this code here,
<!-- Ajax!--><button type="button">Click Me</button>
<p></p>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$.ajax({
type: 'POST',
url: 'random.php',
success: function(data) {
$(".mainContainer").text(data);
}
});
});
});
but this script doesn't show the markup, just the text.
The php file echo's some HTML Markup such as
<img>
<p>
But the script I have is showing the text WITH the markup but I want the script to show the script WITHOUT the markup (using it).
I'm sure it has to do with the
$(".mainContainer").text(data);
What do I change the "text" to?
First time here at StackOverflow, go easy on me!
$(".mainContainer").html(data);