看板 Ajax 關於我們 聯絡資訊
※ 引述《rj5871224 (5871224)》之銘言: : 在維基查到TinyURL的API : https://zh.wikipedia.org/wiki/TinyURL : 只有這一行 : tinyurl.com/api-create.php?url=URLENCODED_SOURCE_URL : 要怎麼在javascript或jquery下調用呢? 查了下GET的語法,看不是很懂 請教是哪寫錯呢? <!DOCTYPE HTML> <html> <HEAD> <meta charset="UTF-8" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> </HEAD> <body> <script> $.get("http://tinyurl.com/api-create.php?url=www.google.com",function(response){ alert(response); }); </script> </body> </html> -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.130.148.4 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1513833251.A.04A.html
tino1991: api-create.php?url=https://www.google.com 12/21 13:19
rj5871224: http://587.renju.org.tw/bb/AAA.html 感謝,但還不行 12/21 13:30
tedwu2001: TinyURL沒做CORS所以沒辦法從瀏覽器端直接call 12/21 14:01
tedwu2001: ref: http://bit.ly/2rV7urJ 12/21 14:04
rj5871224: 哦,原來不是我問題,感謝各位大大指教 12/21 14:30
rj5871224: blog.changyy.org/2011/07/php-tinyurl-api.html 12/21 16:15
rj5871224: icodding.blogspot.tw/2015/12/jquery-php-post.html 12/21 16:17
rj5871224: 最後靠上面那兩個網頁解決了 12/21 16:18