Sending multiple data parameters with jQuery AJAX

前端 未结 7 648
一个人的身影
一个人的身影 2020-11-29 22:00

I am sending an ajax request to a php file as shown here:

function checkDB(code, userid)
{

  $.ajax({
  type: \"POST\",
  url: \"

        
7条回答
  •  一向
    一向 (楼主)
    2020-11-29 22:36

    The answer from Linus Gustav Larsson Thiel refers, I used the following &.ajax() that triggers when a button is clicked and it works great. I could pass day, month and year parameters.

    $('#convertbtn').on('click',function(){
    ageddajax = $("#agedd").val();
    agedmmajax = $("#agemm").val();
    ageyyyyajax = $("#ageyyyy").val();
        if(ageddajax > 0 && agemmajax > 0 && ageyyyyajax >0){
        $.ajax({
            type:'POST',
            url:'ajaxDataAge.php',
            data:'agedd_id='+ageddajax +'&agemm_id='+agemmajax +'&ageyyyy_id='+ageyyyyajax,
                success:function(html){
                $('#cydivage').html(html);
                }
            });
        }   
    });
    

提交回复
热议问题