last day (15 days later) » 

10:13 AM
0
A: PHP file not updating after selecting from drop down

Ryuk LeeSomething you did is not correct way. If you want to submit a select from bargraph.php to data.php and render data here, no need to use ajax. The easiest way is just use GET <form method="GET" name="dataform" action="/data.php" id='dataForm'> <select id="data1" name="data1"> <option value=""

 
I just tried this earlier, it just prints SystemID and ApparentPower in my browser console and data.php file via URL. Do I need to change something in bargraph.html?
 
Try youhost/data.php?data1=DateRecorded&data2=InletVoltage
Yes the form action and form method changed in bargraph.html, do you try my code?
 
Do I need to take out my ajax call or change the ajax call to GET?
Can we talk in chat?
 
remove your ajax call, change bargraph.html and data.php like me
 
what about the submit button function?
ok why is ajax required to be removed?
 
10:14 AM
because you jusst need to use html form submit
you sêê form method="GET"
 
yes
 
action ="/data.php"
button type = submit
no need to use ajax in that case
 
where exactly am i adding action=...
next to form method?
oh i know
But Ryuk, I don't want to navigate away from this page..
 
that's not what i want
i don't want to navigate to another URL, that's why I was using ajax
shall i explain what i am looking to do?
 
10:18 AM
you want the url
is the same before submiting?
 
sorry?
I have a bargraph and two drop down menus. Bargraph is in a javascript file named app.js. It reads content from data.php and the chart is updated.
So I need the drop down menus to update data.php
so then my graph is updated
do you understand?
 
ok i got it
but you said
however when I load the data.php file via browser URL, it is printing SystemID and ApparentPower and not the chosen data
 
yes
when i test it via URL
 
yes because it's post action
 
i need it to print the chosen data from drop down so then my chart will update
 
10:22 AM
you can test post action by url
 
ok how do i make it so, the page does not change after user clicks "submit"
 
If you want to test it
use postman
 
how
 
What is the best way to do this?
 
10:26 AM
 
When user clicks submit I don't want the page to change to data.php
 
yes use ajax
in the success ajax
do the action you want
 
so basically I want the ajax to send the data to data.php and for it to update the data.php file
and then in my app.js I can read that updated data.php file
 
I will post answer after
I have to go meeting
Sr
 
ok thanks
 

last day (15 days later) »