ajax购物车_制作一个简单的AJAX购物车

本教程展示了如何使用AJAX技术和WhizBase创建一个简单的购物车系统。通过会话管理存储和AJAX进行通信,避免了传统Cookie的使用。文章详细介绍了产品页面、添加和移除商品以及显示购物车的实现过程。
摘要由CSDN通过智能技术生成

ajax购物车

Making a simple AJAX shopping cart

制作一个简单的AJAX购物车

Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine.

几年前,我做了我的第一个购物车,我使用了iframe和JavaScript,当时那很好,没有会话或AJAX,我在客户端计算机上使用了cookie。

Today we have more advanced technology, faster, better and more fancy, we can make shopping carts on any site with no need to talk with cookies, let sessions do the storing and AJAX make the communication.

今天,我们拥有更先进的技术,更快,更好,更花哨,我们可以在任何站点上制作购物车而无需与Cookie对话,让会话进行存储,而AJAX可以进行通信。

In this tutorial I will show you how to make a Session/AJAX based shopping cart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.whizbase.com/eng/?p=8

在本教程中,我将向您展示如何使用WhizBase来制作基于Session / AJAX的购物车,如果您想了解有关WhizBase的更多信息,请阅读我以前的文章, 网址http://www.whizbase.com/cn g /?p = 8

The products page

产品页面

Every shopping site have a product page, and that page is where everything starts when you make a shopping. To add products to the shopping cart we need products, every product need an Unique ID. On this page we will also show the cart, we make sure when the visitor comes for the first time it will be empty. Every visit will be a unique shopping and that means a unique session. Sessions are temporary data files created on the server having some data about or from the visitor coming on the site. Every visitor have its own unique session. WhizBase manages sessions automatically, so you just work with session variables as you work with any other, no need to work with session files on the server.

每个购物站点都有一个产品页面,购物时一切都是从该页面开始的。 要将产品添加到购物车中,我们需要产品,每个产品都需要一个唯一ID。 在此页面上,我们还将显示购物车,我们确保访客第一次来时将是空的。 每次访问都将是一次独特的购物,这意味着一次独特的会话。 会话是在服务器上创建的临时数据文件,其中包含有关访问者或来自站点的访问者的一些数据。 每个访客都有自己独特的会话。 WhizBase自动管理会话,因此您可以像处理任何其他变量一样使用会话变量,而无需使用服务器上的会话文件。

In this file which I will name as «default.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值