javascript - PHP echo json_encode(); show the JSON in the page -
i have code:
$route->get_view('index'); echo json_encode(["test"]);
and in html:
<!doctype html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> $(document).on("ready", function(){ $.ajax({ type:"post", url:"../app/routes.php" }).done(function(data){ console.log(data); }); }); </script> </head> <body> jhdjd </body> </html>
Comments
Post a Comment