I'm referring a question answered here.
Trying to append an external PHP file in to jQuery and tried load
.
$(".chatbox").load("./one.php");
This gives me the output;
Your success message!
However the concern is this removes all HTML in the body and does not really 'append' the success message.
I tried the following instead.
$(".chatbox").append("./one.php");
which merely prints this!
./one.php
Am I missing something here?
The .load()
load data from the server and place the returned HTML into the matched element. But you need to use $.ajax()
or $.get()
that get data and return it into callback function.
$.get("./one.php", function(data) {
$(".chatbox").append(data);
});