php - Javascript is not working on ajax call -
i've multiple select on code onchange
function ajax
call,when value passed through ajax gets data database , plot chart highcharts
script,my problem javascript
not worrking on ajax call,please suggest best,thanks in advance
source.php
<script> function something(str) { if (str=="") { document.getelementbyid("div1").innerhtml=""; return; } if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } else { xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("div1").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("get","destination.php?q="+str,true); xmlhttp.send(); } </script> <body> <select multiple="multiple" onchange="something(this.value);"> <option>value1</option> ...... <option>valuen</option></select> <div id="div1"></div>
destination.php
on here (destination page) data database using requested value ajax
<?php include("config.php"); $var=$_request['str']; $query=mysql_query("select * table column=$var"); while($row=mysql_fetch_array($query)) { $value[]=$row['data']; } <script> <!--- here highcharts script ploting graph above fetching value database --!> </script> ?>
Comments
Post a Comment