Addie Baker
asked on
Reload a php query that is included in html page when select option is pressed.
I have a index.php page that that uses this in the body.
In that multibox.php i have a div id container that loads my highcharts.
On that same multibox.php i have a query to load the table data.
I have a select option box that is filled by a mysql query on same page.
here is what the options look like
So when they are clicked they reload the index.php (same page they are included on) and pass id.
I then have this on the multibox.php to check the id
if ($_GET['id'] == '')
So i can change the query based on that id so when the page loads it shows the chart with data for the selected.
SO... my question.
How can i just refresh that php with data for graph?
I did the following but it reloads the entire page into the live-area div.
<div id="live-area">
<?php include ('assets/php/multibox.php');?>
</div>
In that multibox.php i have a div id container that loads my highcharts.
On that same multibox.php i have a query to load the table data.
I have a select option box that is filled by a mysql query on same page.
here is what the options look like
echo "<option value=index.php?id=$row[activity]/$row[app_name]>$row[app_name]</option>";
So when they are clicked they reload the index.php (same page they are included on) and pass id.
I then have this on the multibox.php to check the id
if ($_GET['id'] == '')
So i can change the query based on that id so when the page loads it shows the chart with data for the selected.
SO... my question.
How can i just refresh that php with data for graph?
I did the following but it reloads the entire page into the live-area div.
echo "<select name=category value='' onchange=\"runthis(this)\"></option>";
<script type="text/javascript">
function runthis(sel) {
var page = sel.value;
$.ajax({
url: page,
success: function (response) {
$('#live-area').html(response);
}
});
}
</script>
You need to create a page that is called by the ajax function that only contains the data (HTML) for the graph and nothing else
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Firgured out the answer myself