Пример #1
0
 /**
  * 以JSONP顯示資料
  * 
  * 不需要變動了
  * @param Array $data 以關聯式陣列組成的回傳資料
  * @param String $callback
  */
 private function _display_jsonp($data, $callback = NULL)
 {
     send_js_header($this->output);
     if (is_null($callback)) {
         return $this->_display_data($data);
     } else {
         $data = kals_json_encode($data);
         $pos = stripos($callback, '=');
         // 取得 = 號的位置
         $callback_hash = $pos === false ? '' : substr($callback, $pos + 1);
         // 擷取 = 後面的字串
         $vars = array('callback_hash' => $callback_hash, 'json' => $data);
         $this->load->view($this->dir . 'display_jsonp', $vars);
     }
 }
Пример #2
0
 /**
  * 完成POST
  * 
  * @author Pulipuli Chen <*****@*****.**>
  */
 protected function _display_post_complete()
 {
     send_js_header($this->output);
     $this->load->view('web_apps/display_post_complete');
 }
Пример #3
0
 protected function _display_jsonp($object, $callback = NULL)
 {
     if (is_null($callback)) {
         return $object;
     }
     //test_msg($object['policy']['my_custom']);
     $json = kals_json_encode($object);
     $pos = stripos($callback, '=');
     // 取得 = 號的位置
     //test_msg("_display_jsonp", gettype($callback));
     if ($callback !== NULL && $callback !== "") {
         $callback_hash = $pos === false ? '' : substr($callback, $pos + 1);
         // 擷取 = 後面的字串
         //echo "{$jsonp}({$json})"; // 輸出
         $vars = array('callback_hash' => $callback_hash, 'json' => $json);
         send_js_header($this->output);
     } else {
         test_msg("_display_jsonp", "send_text_header");
         $vars = array('callback_hash' => NULL, 'json' => $json);
         send_text_header($this->output);
     }
     $this->load->view($this->dir . 'display_jsonp', $vars);
 }
Пример #4
0
 protected function _display_jsonp($object, $callback = NULL)
 {
     if (is_null($callback)) {
         return $object;
     }
     send_js_header($this->output);
     $json = json_encode($object);
     $pos = stripos($callback, '=');
     // 取得 = 號的位置
     $callback_hash = $pos === false ? '' : substr($callback, $pos + 1);
     // 擷取 = 後面的字串
     //echo "{$jsonp}({$json})"; // 輸出
     $vars = array('callback_hash' => $callback_hash, 'json' => $json);
     $this->load->view('web_apps/display_jsonp', $vars);
 }