jQuery - Can threads/asynchronous be done?

后端 未结 2 1322
耶瑟儿~
耶瑟儿~ 2020-11-27 08:49

I\'m currently using AJAX with Django Framework.

I can pass asynchronous POST/GET to Django, and let it return a

2条回答
  •  粉色の甜心
    2020-11-27 09:25

    Deferreds/promises won't help you here. JS in the browser is always single-threaded.

    The trick is not to build up DOM elements via JS. That is always going to be expensive and slow. Rather than passing data in JSON from Django and building up a DOM dynamically, you should get Django to render a template fragment on the server side and pass that whole thing to the front-end, where the JS can simply insert it at the relevant point.

提交回复
热议问题