如何使用JQuery,Backbone和PHP将购物车数据插入MySQL数据库

时间:2013-06-12 14:33:40

标签: php jquery mysql backbone.js

我在这里找到了代码,但它没有提供插入数据库的内容 http://www.spicevanjava.nl/tech-talk/shopping-cart-ui-demo-mobile-version/

这里是例子 的index.html

<script type="text/template" id="submit-btn-tmpl">
    <button data-icon="arrow-d" data-theme="b" id="submit-btn">Submit</button>
</script>

购物-cart.js

// Submit Button
var SubmitButton = Backbone.View.extend({
    el: '.basket-footer',

    //get template
    template:  $('#submit-btn-tmpl').template(),

    appRouter: null,

    initialize: function() {
        // set appRouter
        this.appRouter = this.options.appRouter;
    },

    render : function () {

        var totalPrice = 0

        // get total price
        if (this.appRouter.basketItems.length > 0)
            totalPrice = this.appRouter.basketItems.totalPrice();

        // clean up
        $('#submit-btn').remove();

        // and finally render this view with total price
        $(this.el).append($.tmpl(this.template, {price:totalPrice}));
    }
});

0 个答案:

没有答案