Onchange dropdown values query resp. tables - with php , mysql , ajax , jquery

后端 未结 1 1501
刺人心
刺人心 2021-01-24 09:31

Main Drop-down :


      
      
      
      
      
    

JS Ajax Function

function call_ajax_fun(str)
{

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.onreadystatechange=function()
    {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {

            var result = xmlhttp.responseText;
            if(xmlhttp.responseText!='')
            {
                document.getElementById('your_result_div_id').innerHTML =result ;
                            // put your result in your div 
            }   
        }
    }



    var url="get_result.php?pas_val="str;

    xmlhttp.open("GET",url,true);

    xmlhttp.send();
}

and your get result file will be as follows

get_result.php


0 讨论(0)
提交回复
热议问题