Advertisement
Guest User

JSONP

a guest
Apr 18th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1.  
  2. <?
  3.     header('content-type: application/json; charset=utf-8');
  4.     include_once '../model/RSSParser.class.php';
  5.     include_once '../model/News.class.php';
  6.     include_once '../util/util.class.php';
  7.  
  8.     $util = new Util();
  9.  
  10.     $folha_news = new News($_GET['rss_url']);
  11.     // echo $util->JSON_prettyPrint(json_encode($folha_news->array_news));
  12.    
  13.     /**
  14.      *  func is a Javascript function defined in default.js
  15.      *
  16.      *      $_GET['element']    is the id of the element on the DOM ( will be filled with the news array ),
  17.      *                          if you pass w/o quotes you pass the global variable ( that represents the HTML Object )
  18.      *                          to the javascript otherwise you pass it's ID
  19.      */
  20.     echo "func(".json_encode($folha_news->array_news).",{$_GET['element']},{$_GET['qtd']})";
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement