Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. var graph = {
  2. _ds2: [],
  3. display_graph: function(){
  4. graph._data = [];
  5. _data = "class=graph&func=get_all";
  6. $.post(window.location.href, {async: false}, _data, function(data){
  7. var data = $.parseJSON(data);
  8. //console.log(data)
  9. for (var i = data.length - 1; i >= 0; i--) {
  10. _ds1 = [];
  11. _ds1.push(parseInt(data[i]['year']), parseInt(data[i]['income']));
  12. graph._data.push(_ds1);
  13. };
  14. ///graph.create_graph(graph._ds2.reverse());
  15. //return graph._data;
  16. });
  17. return graph._data;
  18. }
  19.  
  20. $(document).ready(function(){
  21. /* graph 1*/
  22. console.log(graph.display_graph());
  23. });
  24.  
  25. function foo(){
  26.  
  27. fooAjax(function(data){ console.log(data) } //data is the data retrieved by the ajax
  28. }
  29.  
  30. fooAjax(callback){
  31.  
  32. $.ajax({
  33. success: function(response) {
  34. callback(response)
  35. });
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement