Ajax = One Page Less Submit

博客讨论了Ajax应用中One page one application模式。指出该模式在中国普及存在问题,如CMS系统无法被搜索引擎搜索和收藏,且采用此架构需重写代码模板,不便维护。作者暂不考虑该模式,而是用Ajax改造系统部分功能,如表单填写,可避免多次提交问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

看到网上很多人说ajax的应用程序应该是One page one application。我觉得这种看法还不适合我目前的开发模式。

每一个应用都有自己的特殊的结构,使用One page one application 的应用我也看过很多了,像turboajax,等等都可以说非常好。但是这类的程序在中国普及有一些问题。

首先cms系统的目的是可以被网上搜索和搜藏。如果使用ajax,这些页面都没有固定的地址,无法被搜索引擎搜索,也无法被浏览器搜藏。这是很多cms的运营商所不愿看到的。 这样的系统和flash的RIA很像,问题也很相似。

二。如果在一个新的系统中重新使用opoa架构,那么以前的很多快速开发的代码模板就要重写。对系统维护等都带来很大的不便。

所以我暂时不会考虑使用opoa的设计模式。而是通过ajax对系统的部分功能进行改造。

最典型的就是填写表格,很多表单格式非常复杂。就拿履历表来说吧。通常都是把一张表分解成不同部分来填写。例如appfuse的demo。如果使用ajax就可以避免这个问题。在一个界面里面填写。一些数据可以先悄悄存放到后台session里面。最后一次性的submit完成提交。

当然这样的话,ajax就有点像一个奇计淫巧般可有可无的东西了,但是他仍然是十分必要的。过多的submit,除了让客户可能承受很大的界面上的速度影响。(现代的webapp,美工的比例很大)。而且server端还要维护很多状态标示。

AI Overview Implementing selective checkout with checkboxes on a cart page typically involves allowing users to select specific items in their cart for purchase, rather than requiring them to purchase all items. This functionality is not a standard feature in most e-commerce platforms and usually requires custom development or the use of specialized plugins/apps. General Approach: Modify the Cart Template: Add a checkbox next to each item in the cart. Ensure the checkbox is linked to the specific product or line item. Handle User Selections: Use JavaScript to detect changes in checkbox states (checked/unchecked). When a checkbox is selected or deselected, update the cart's subtotal and potentially the items that will be included in the checkout process. Adjust the Checkout Process: When the user proceeds to checkout, ensure that only the items corresponding to the selected checkboxes are passed to the order. This may involve modifying the platform's core checkout logic or using hooks/filters provided by the platform. Platform-Specific Considerations: WooCommerce (WordPress): Requires custom code in functions.php or a custom plugin to add checkboxes, manage selections, and modify the checkout process. You might use AJAX to update the cart dynamically as selections are made. Shopify: Involves modifying theme files (e.g., cart-template.liquid, theme.js) to add checkboxes and JavaScript to handle the logic. This often requires familiarity with Liquid (Shopify's templating language) and JavaScript. Other Platforms: The specific implementation will vary based on the platform's architecture and extensibility options. It may involve similar approaches of template modification and custom code. Important Notes: Complexity: Implementing selective checkout can be complex and may require advanced coding skills. User Experience: Carefully consider the user experience implications of selective checkout to ensure it is intuitive and does not cause confusion. Testing: Thoroughly test the functionality to ensure that selected items are correctly processed and that no loopholes exist (e.g., refreshing the page causing issues with selected items). I want to achieve this selective checkbox function in my cart page. Im using woocommerce and woodmart theme. Please advice on what to do
最新发布
07-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值