javascript - json_encode not working with $.get() -


i have file graph.php, writing both php code , javascript code.i using flot plot graph while passing response, using json_ecode($arr); not getting response , graph disappears while using same.

<?php     //connected mysql , after performing functions got 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, browser downloading graph.php , nothing else coming.

try doing ajax response, or @ least inspecting it:

$('#btn'. click(function () {     $.get("graph.php")     .done(function (response) {         console.log(response);     })     .fail(function (err) {         console.log(err);     }); }); 

Comments