html - How to store returned string from php file to Javascript variable through Ajax -
i want call php function ajax , have contents returned webpage.
say have file called latest.php returns simple html.
$result = "<div> text </div>"; echo $result;
how can write ajax script calls php file, returns html , stores in javascript variable?
javascript variable:
var myvar; $.get("latest.php", function(data) { myvar = data; });
insert document:
$.get("latest.php", function(data) { $("#myelement").html(data); });
or
$("#myelement").load("latest.php");
Comments
Post a Comment