Hi I'm using jquery ajax function with php. Here is the my problem; Firstly I'm using datatype:"html" my problem is php variables not returning.
js
$.ajax({
type: "POST",
dataType: "html",
url: ajaxurl,
data:dataajax,
success:function(data) {
var $data = $(data);
$(".list").append($data);
},
error : function(jqXHR, textStatus, errorThrown){
}});
php
echo "<div>".$_POST['value']."</div>";
if I use like this it's working but when I remove the html tags ajax return nothing.
broken php
echo myfunction($_POST['value']);
echo $_POST['value'];
How can I fix this or can I use return $output with jquery ajax?
myfunction()does.