Re: [問題] 用jquery將值不同步存入陣列

看板Ajax作者 (葉酸酸)時間14年前 (2011/07/31 11:16), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
※ 引述《BM0108 (衝)》之銘言: : 我要用ajax的方式從其他地方讀入數值到我的javascript中 : 每讀入一筆資料(可能是str or obj),就將這筆資料存到array的一個index : 這是我第一次用jquery,查不到比較適當的寫法 : 有請版上前輩給點建議,謝謝! 既然你是拿資料,那我就假設你用 GET。請看這個範例: jQuery.get() – jQuery API http://api.jquery.com/jQuery.get/ Example: Alert out the results from requesting test.php (HTML or XML, depending on what was returned). 如果剛好是跟 server 拿 json 的話,可以用 getJSON jQuery.getJSON() – jQuery API http://api.jquery.com/jQuery.getJSON/ 還有其他的請看一下: Shorthand Methods – jQuery API http://api.jquery.com/category/ajax/shorthand-methods/ > -------------------------------------------------------------------------- < 順便告訴你 jQuery API 要怎麼使用好了,很久以前我剛開始用的時候也覺得看不太懂。 jQuery API http://api.jquery.com/ 這是 jquery api document。 sidebar 有個 section 叫 Browse the jQuery API 下面很多分類:ajax、attributes 還有很多,各分類還有小分類。 想要知道那個分類可以幹嘛,大部份的時候只要點進去,在 content 的上面會介紹。 多看文件就會知道要用什麼 method 了。 -- Oni devas ami animalojn. Ili estas tiel bongustaj. One should love animals. They are so tasty. 每個人都應該愛動物,他們是如此美味。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 175.180.52.143

07/31 13:38, , 1F
thank you so much!!
07/31 13:38, 1F
文章代碼(AID): #1EDCaOv_ (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1EDCaOv_ (Ajax)