Hello,
I am trying to use Ajax in order to improve the speed of my website. I am trying to pull data from a dynamic page and insert the data onto the current page.
There are 3 three things I am trying to accomplish:
1) Have a user click a checkbox to toggle the change of data
2) Pull data from another dynamic page
3) Show that data on the current page that was clicked with a checkbox
Here is the checkbox region of the code:
$stastic_id is a value that varies between 1 and 100. getStatisticFro mId ( $statistic_id ) returns the name of the Statistic.
The page that I am pulling data from is hosted here: http://tyrone.pae.me/pulldata.php?p=1&s=1. As the value for p varies it changes the data. As the value for s varies it changes the data. s is the $statistic_id referenced above.
Here is the code to show the data on pulldata.php on the current page:
You'll notice the refreshData function I am trying to run in the Ajax portion is referenced above.
If you can provide any assistance on how I can make all three steps of this process work I would be very appreciative.
I am trying to use Ajax in order to improve the speed of my website. I am trying to pull data from a dynamic page and insert the data onto the current page.
There are 3 three things I am trying to accomplish:
1) Have a user click a checkbox to toggle the change of data
2) Pull data from another dynamic page
3) Show that data on the current page that was clicked with a checkbox
Here is the checkbox region of the code:
Code:
<script type="text/javascript">
$('input[type=checkbox]').live( 'click', refreshData );
</script>
<input type="checkbox" id="checkbox_<?= $statistic_id; ?>" <?= $i==0 ? 'checked="checked"' : null; ?> />
<label for="checkbox_<?= $statistic_id; ?>"><?= getStatisticFromId ( $statistic_id ); ?></label>
The page that I am pulling data from is hosted here: http://tyrone.pae.me/pulldata.php?p=1&s=1. As the value for p varies it changes the data. As the value for s varies it changes the data. s is the $statistic_id referenced above.
Here is the code to show the data on pulldata.php on the current page:
Code:
<script>
function refreshData() {
var url = "/frontend.php?p=" + tags + "&s=" + statistic + "&y=" + year;
$.getJSON( url,
function(data_from_pulldata){
var data = data_from_pullata;
</script>
If you can provide any assistance on how I can make all three steps of this process work I would be very appreciative.