0👍
✅
From the code you’ve shown, it doesn’t look like you’re passing the input value along with your ajax request, you should add something like
$.ajax({
url : "/graph.php",
type : "GET",
data : {input : $('#subject').val()}, <-- added this
success : function(data){
In order to be able to see the value in $_GET['input']
on the php side.
But there is another issue I believe, your ajax request is sent as soon as your document is ready ($(document).ready(function(){
), but at that time your input is most likely going to be empty. You probably want to change it to $('form[name="form"]').on('submit',function(event){event.preventDefault(); ...})
, assuming your form only does that one thing (display a graph according to the input)