How to pass 2 variables to a php document with jquery

Posted by Nikos on Stack Overflow See other posts from Stack Overflow or by Nikos
Published on 2010-04-28T13:32:16Z Indexed on 2010/04/28 13:43 UTC
Read the original article Hit count: 367

Filed under:
|
|
|
|

Hello I have two text inputs which get their values from a datepicker. What I want to do is when user selects the two dates script pass these two values to a php document in which I make some checks and I return some html.

Here is what I'm trying to do:

(#to and $from are 2 input texts)

$(document).ready(dateinput_change);
  function dateinput_change(){
    $('#to').change(check_availability);
    $('#from').change(check_availability);
  }
  function check_availability(){
    var to=$('#to').attr('value');
    var from=$('#from').attr('value');
    $.get("get_availability.php?to="+ to +"&from="+ from, show_availability);
  }
  function show_availability(available){
    $('#availability').html(available);
  }

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX