Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var graph = {
- _ds2: [],
- display_graph: function(){
- graph._data = [];
- _data = "class=graph&func=get_all";
- $.post(window.location.href, {async: false}, _data, function(data){
- var data = $.parseJSON(data);
- //console.log(data)
- for (var i = data.length - 1; i >= 0; i--) {
- _ds1 = [];
- _ds1.push(parseInt(data[i]['year']), parseInt(data[i]['income']));
- graph._data.push(_ds1);
- };
- ///graph.create_graph(graph._ds2.reverse());
- //return graph._data;
- });
- return graph._data;
- }
- $(document).ready(function(){
- /* graph 1*/
- console.log(graph.display_graph());
- });
- function foo(){
- fooAjax(function(data){ console.log(data) } //data is the data retrieved by the ajax
- }
- fooAjax(callback){
- $.ajax({
- success: function(response) {
- callback(response)
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement