I am sending some variables from mypage.php to ajax.php page. On ajax.php I check some conditions and compiled some HTML based on request. Now I need to return that formatted HTML back to mypage.php and display. I do see request sent and response in my dev tools, however nothing seems to render on return. What am I missing?
mypage.php
<div id="myContainer"></div>
// JS
$.ajax({
type: "POST",
url : "ajax.php",
data: {
"op": "html",
"wd": wd
},
dataType : "json",
success: function(response)
$("#myContainer").append(response.images);
}
});
ajax.php
// php code here creating $images
echo '{ "images": "'.$images.'" }';