Mais conteúdo relacionado
Semelhante a symfony & jQuery (PUG) (20)
Mais de Massimiliano Arione (17)
symfony & jQuery (PUG)
- 13. IN PRACTICE: LINK <?php echo link_to (' + ', ' cart_increase ', $item) $(' div#cart a.increase ').click(ajaxIncrease);
- 14. var ajaxIncrease = function (e) { $.ajax({ url: this.href + ' ?sf_format=json ', success: function (r) { increase(r, e.target); } }); return false ; }; var increase = function (result, a) { var $li = $(a).parents('li'); var $span = $li.find('span.quantity'); var oldq = parseInt($span.text(), 10 ); var newq = oldq + 1 ; $span.empty().append(newq); $(' span#total ').empty(); $(' span#total ').append(result.total); };
- 16. <?php // actions.class.php public function executeCartIncrease(sfWebRequest $request) { $this->product = $this->getRoute()->getProduct(); $this->getUser()->cartIncrease($this->product); // was $this->redirect('@homepage'); $this->redirectUnless($request->isXmlHttpRequest(), ' @homepage '); }
- 18. var ajaxFilter = function(e) { var $form = $(this); $.ajax({ type: ' POST ', url: $form.attr('action') + ' ?sf_format=json ', data: $form.serializeArray(), success: showProducts }); return false ; };
Notas do Editor
- qualcuno NON conosce symfony?
- Qualcuno NON conosce jQuery?