Found the problem .. right under my nose.
var log = $('view_cart').empty().addClass('ajax-loading');
needs to be
var log = $('view_cart').addClass('ajax-loading');
Thanks.
On Nov 13, 3:13 pm, Anthony <[EMAIL PROTECTED]> wrote:
> Sorry I just saw your response! Do you not get email notification for
> posts??
>
> Okay .. I went at it from a different approach. What I'm doing is
> using aformfrom a php file that is included into my main page. When
> the user updates and submits theformit is updating itself. The
> problem is if I set the response to the same div as the included file
> it won'tupdateBUT if I set the response to any other div it works.
> Here's what I have:
>
> JS
>
> window.addEvent('domready', function() {
> $('myForm').addEvent('submit', function(e) {
> e.stop();
> var log = $('view_cart').empty().addClass('ajax-loading');
> this.set('send', {onComplete: function(response) {
> log.removeClass('ajax-loading');
> log.set('html', response);
> //update:log; <-TRIED THIS
> }});
> this.send();
> });
>
> });
>
> Main Page
>
> <formid="myForm" action="../site_i/INC/moo-cart.php" method="post">
> <div id="view_cart">
> <?php include('../site_i/INC/moo-cart.php'); ?>
> </div>
> <input type="submit" name="button" id="submitter" /><input
> type="hidden" name="place-order" value="TRUE" id="place-order" />
> </form>
>
> moo-cart.php // watered down for testing
>
> <?php
> if(isset($_POST['my_test'])) {
> $val = "yes = ".$_POST['my_test'];} else {
> $val = "no";
> }
>
> print '<input type="text" name="my_test" id="my_test" value="'.$val.'"/>';
>
> ?>
>
> Thanks!
>
> On Oct 26, 2:59 pm, hellspawn <[EMAIL PROTECTED]> wrote:
>
> > is not very clear what you want to do
>
> > you want to make an "ajax" shop ? so the data is refreshed without
> > refreshing the page?
> > if yes, you can use json to transport the data to server and back
>
> > give us more details, so we can help you
>
> > On Oct 25, 8:49 pm, Anthony <[EMAIL PROTECTED]> wrote:
>
> > > I've searched all over and can't figure out the right/best way to do
> > > this. I'm tearing apart the mootools demo for the contactform. What
> > > I'm doing is setting up a checkoutformfor a shopping cart. When the
> > > user selects a shipping method it updates the total.
>
> > > 1st attempt I tried wiping two cells of a table and replacing them w/
> > > the php output, but that doesn't work too well.
>
> > > 2nd attempt what I think is probably better is to target two different
> > > elements toupdate. One being the shipping rate and two being the
> > > total amount of the cart. Here's what I'm thinking, but I'm not sure
> > > how to pull a specific variable from the php file and convert it to
> > > the javascript .. I'm pretty sure this isn't possible, but I'm new to
> > > this.
>
> > > this.set('send', {onComplete: function(response) {
> > > log.removeClass('ajax-loading');
> > > log.set('html', response); // this would be the
> > > shipping rate
> > > selected
> > > //ctotal.set('html',
> > > parseInt(subtotal)+parseInt(response));//
> > > works, but you need to get the value of the current cart total not the
> > > total from the id element .. may not work
> > > ctotal.set('html', test); // test being a $test =
> > > "whatever";
> > > variable from the php file
> > > }});
>
> > > Any help is greatly appreciated. Thanks.