How to pass a JavaScript variable to JQuery
As I mentioned in the title I want to pass a Javascript variable to
JQuery. I spend the whole day to find out a way but got nothing. I tried
to using ajax to pass a variable to PHP then I can get the response data.
But when I want to pass it into highcharts, it didn't work, could anyone
show me how to do this? I will be very appreciated.
//this is the ajax I used to send the request to PHP , I can get the data
in data_ajax.
function chooseCategory(mat_id){
var ajax = ajaxObj("POST", "test.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
data_ajax = ajax.responseText;
alert(data_ajax);}
}
ajax.send("id=" + material_id);
}
//this is part of the jquery code, the charts can not get any data
from variable data_ajax.
$(function () {
$('#container3').highcharts({
...
...
series: [{ type: 'line', name: '#numbersF', data: data_ajax
No comments:
Post a Comment