javascript - Is Ajax still used for cascading menus now? Or when loading the page, load all the required data and then operate it through JS? -PHP Chinese website Q&A-javascript - Do we still use Ajax when making cascading menus? Or when loading the page, load all the required data and then operate it through JS? -PHP Chinese website Q&A
javascript - Is Ajax still used for cascading menus now? Or when loading the page, load all the required data and then operate it through JS? -PHP Chinese website Q&A-javascript - Do we still use Ajax when making cascading menus? Or when loading the page, load all the required data and then operate it through JS? -PHP Chinese website Q&A
Let’s take a look and learn.
JS数组可以实现。
还是要看需求来确认实现方法。
比如配送地区,不是全范围的,但又经常性的增加/变动,那用ajax等方式后期维护成本相对低。
而如果是让用户选择所在城市的,这种联级数据不变动的,则用数组即可。
这些都是固定不变的,没必要Ajax了,直接生成静态Js数组
这里不能传文件么,我刚整理出来的三级联动,兼容IE/Chrome/FF
直接输出在页面上的体验会比较好,ajax要等。前后端约定统一的话维护成本应该是差不多的。