On 6 nov, 09:10, palgo <rusha...@gmail.com> wrote:

> So I tried your concept for the values passed to GET as well, and got
> this (which seems to work correcly):
>
>         $(".A, .B").keyup(function(event){
>         $.get("script.php", { a: $(event.target).closest("tr").find
> ("input.A").val(), b: $(event.target).closest("tr").find("input.B").val
> ()},
>         function(data){
>         $(event.target).closest("tr").find("input.C").val(data);
>         });
>         })
>
> Not so neat code, but it works atleast! :)

Hey palgo,

Good to hear you got it to work! I rewrote above code so it's easier
to read. Again, it's untested, but it should illustrate the concept.

$(".A, .B").keyup(function(event) {
  var current_row = $(event.target).closest("tr");
  var input_a = $(current_row).find(".A");
  var input_b = $(current_row).find(".B");
  var input_c = $(current_row).find(".C");

  $.get("script.php", { a: $(input_a).val(), b: $(input_b).val() },
function(data){
    $(input_c).val(data);
  });
});

Maarten

Reply via email to