JSONP 實做:使用 Google Ajax Search

 

範例網頁:JSONP 實做:使用 Google Ajax Search

Google Ajax Search with JSONP

※ 詭異的是,我使用 $.get 都只能收到 400 Bad Request,只能用 $.ajax 才能正常。

  1. $.ajax({
  2.       url: 'http://ajax.googleapis.com/ajax/services/search/web',
  3.       data:{
  4.         'key': gsearch.key,
  5.         'v': '1.0',
  6.         'q': encodeURIComponent(k), // + '+site:essoduke.org' 搜尋網站,
  7.         'rsz': 'large',
  8.         'hl': 'zh-TW',
  9.         'start': s
  10.       },
  11.           dataType: 'jsonp',
  12.           success: gsearch.fetch
  13.     });

參考資料:

回首過往今日

標籤: , , ,

相關文章

No Comments yet »

本篇文章迴響的訂閱源料 TrackBack URI

發表迴響

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.