alexapollo
V2EX  ›  问与答

是否能把 AJAX 的回应分块(div)加载到 div 里?

  •  
  •   alexapollo · Apr 12, 2014 · 3056 views
    This topic created in 4483 days ago, the information mentioned may be changed or developed.
    比如我发出了一个AJAX请求,对应的,AJAX回复了5个div组成的内容,而我需要把它们各自放到对应的div里。
    4 replies    1970-01-01 08:00:00 +08:00
    zieglar
        1
    zieglar  
       Apr 12, 2014   ❤️ 1
    服务器返回给你一个 json 对象,key 是跟 div 对应起来的,你来 forEach key 就好了
    alexapollo
        2
    alexapollo  
    OP
       Apr 12, 2014
    @zieglar 现在是用jquery封装好的get接口,貌似不是json对象?
    Livid
        3
    Livid  
    MOD
    PRO
       Apr 12, 2014   ❤️ 1
    当然可以,你仔细读一下 jQuery 的文档吧。
    zieglar
        4
    zieglar  
       Apr 12, 2014
    @alexapollo jQuery 有个方法叫 getJSON
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3210 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 00:25 · PVG 08:25 · LAX 17:25 · JFK 20:25
    ♥ Do have faith in what you're doing.