I have a file graph.php, where I am writing both the php code and javascript code.I am using flot to plot graph
While passing the response, I am using json_ecode($arr);
but I am not getting any response for this and the graph disappears while using the same.
<?php
//connected the mysql and after performing some functions got an array
echo json_encode($arr);
?>
<script src="jquery.js"></script>
<script>
$('#btn'. click(function(){
$.get("graph.php",function(response){},"json")
});
</script>
I added header("Content-type :application/json");
While using this, the browser is downloading graph.php and nothing else is coming.
You can try some simple array for testing. Not MySql result.
Try doing something with the AJAX response, or at least inspecting it: