Coyote
-
Content count
2 -
Joined
-
Last visited
Posts posted by Coyote
-
-
hi !
(My English is very bad... sorry)
i `ve a problem using ajax.
i`m developing a proyect using PEAR, SMARTY, PHP, FUSIONCHARTS and now .... my boss say me "ok, let`s include ajax" ...
I`ve been searching for any information and don`t find nothing. please just need some pages, or tutorias, or something to help me.
PD: Already I have seen the main pages of PEAR, SMARTY, PHP, FUSIONCHARTS, but they don`t give me "instructions" to how combinate ajax with the another tecnologies.
Regards.
Example (Code) for Charts using AJAX
in General usage
Posted · Report reply
hi !
( sorry for my english ... again )
I did it!
The Solution:
** in the main page, include de basic code to load a FC
(The $XML2Lines is a smarty variable, you`ll use another XML file)
<div id="chart7">
<script type="text/javascript">
var chart = new FusionCharts("charts/MSLine.swf", "chart7", "700", "300", "0", "1");
chart.setDataXML("{$XML2Lines}");
chart.render("chart7");
ObjectChart = chart;
GoAjax();
</script>
</div>
** the GoAjax() and UpdateGraphic() javascript function
function GoAjax(id)
{
TimerGraphic = setTimeout("UpdateGraphic()", 3000);
} // you`ll understand the parameters, sure.
function UpdateGraphic(id)
{
var object = document.form_mediciones.ddlObject.value;
var sensor = document.form_mediciones.ddlSensor.value;
var variable = document.form_mediciones.ddlVariable.value;
var ini_filter = document.form_mediciones.inicio_filtro_hidden.value;
var ter_filter = document.form_mediciones.termino_filtro_hidden.value;
var company = document.form_mediciones.company_hidden.value;
var iStartCounter = document.form_mediciones.iStartCounter_hidden.value;
var nValuesToCalc = document.form_mediciones.nValuesToCalc_hidden.value;;
var URL = "SetSourceOfGraphic.php?";
URL = URL + "im=" + id;
URL = URL + "&fi=" + ini_filter;
URL = URL + "&ft=" + ter_filter;
URL = URL + "&ep=" + company;
URL = URL + "&object=" + object;
URL = URL + "&sensor=" + sensor;
URL = URL + "&variable=" + variable;
URL = URL + "&iStartCounter=" + iStartCounter;
URL = URL + "&nValuesToCalc=" + nValuesToCalc;
var ajax=objetoAjax();
ajax.open("GET", URL, true);
ajax.onreadystatechange=function()
{
if (ajax.readyState==4)
{
ObjectChart.setDataXML(ajax.responseText);
}
}
ajax.send(null);
}
** end
I hope you understand de MAIN IDEA of code, a remove some variables to make more "friendly" the solution.
the another tecnologies ( smarty, pear ), have not idea of my code, just javascript and html play this.
PD: the objetoAjax() function is in every where in the internet, you have to find it, it`ll be the dificulty of my solution. ( always have a dificulty )
any question, find me...
Regards.