{ // 使用$.post()方法提交购买请求 $.post('goods_buy', {goodsid:goodid}, function(data) { // 服务器返回数据处理 if (data === 'ok') { // 成功代码 alert('Purchase successful!'); } else { // 失败代码 alert('Purchase failed!'); } });

使用$.post()方法购买商品:成功与失败处理