Thanks Liam

Liam Potter wrote:

You may find it easier to use the form plugin though.
http://malsup.com/jquery/form/

Richard Wheatley wrote:

Liam - i have pushed the return false down one set of brackets which has fixed one prob...however still not quite there... reading docs on parents function and its clear as mud to me right now..

Liam Potter wrote:

you need to first of all, write a valid form.

<form>
<input type="hidden" value="1" />
<input type="submit" class="submit" />
</form>

then your script needs to be

<script language="javascript">
$(document).ready(function() {
   $('.submit').click(function() {
    $(this).parents('form').each(function(){
       var msg = $('.qty').val();

       $.post("<?= site_url('cart/add_cart') ?>", {qty: msg}, function
() {
           $('#sidebar').load('http://localhost/update_records.php');
       });
         return false;
});
   });

});
</script>


ashbyrich wrote:
I have multiple forms of the nature

[code]
<form>
<input hidden value =1>
<input submit class="submit"
</form>
<form>
<input hidden class=qty value =2>
<input submit class="submit"
</form>

[/code]

I have the script as follows....

[code]

<script language="javascript">
$(document).ready(function() {
    $('.submit').click(function() {

        var msg = $('.qty').val();

$.post("<?= site_url('cart/add_cart') ?>", {qty: msg}, function
() {
            $('#sidebar').load('http://localhost/update_records.php');
        });
          return false;
    });

});
</script>

[/code]

Problem is that i whichever submit button i press it only grabs value
1.  This is completely logical, I just don't know how to modify the
script to get the right form...
Apologies for dumb question..I will read the docs/do tuts soon..


Reply via email to