on Change of dropdown list showld call the php function

前端 未结 2 1125
既然无缘
既然无缘 2020-12-10 10:05

On change of the dropdown list, A php function should called.

Inside the PHP function I will do some calculation. Later I need to set the value of a text box or else

2条回答
  •  爱一瞬间的悲伤
    2020-12-10 10:30

    You can't call a php function from js or html, but you can do that by ajax call to a php function where you can perform your calculation and then return the result value to js, so then you can do by js to html...

    Update:

        
    
    function getIPL(id)
        {
                $.ajax({
                           type: "GET",
                           url: "EmpLeave.php",
                           data: "emp_Id =" + id,
                           success: function(result){
                             $("#somewhere").html(result);
                           }
                         });
        };
    
    
     // Empleave.php file....
      if(isset($_GET['emp_Id'])){
         GetTotalPL($_GET['emp_Id']);
     }
    
     function GetTotalPL($id){
      // do your calculation...
    }
    

提交回复
热议问题