DEV Community

Discussion on: How to get HTML form data into PHP function Arguments?

Collapse
 
aveeva profile image
Aveeva

Solved :

<script>
    $(document).ready(function(){
    $('#new').on('change',function(){

    var zip = $("#zip_postal_code").val();
    var country = $("#country").val();

    $.ajax({
    type: "POST",
    // url: "ajax_ship_cost_data.php",
    url: "sp_cost.php",
    dataType: "text",
    data: {zip_postal_code : zip, country: country},
    success: function(data)
    {
        // Check the output of ajax call on firebug console
         //console.log(data);
        $('#findata').html(data);
        $('#shipping_cost').val(data);

    }

});

});
});