I've read lots of threads on passing Jquery variables to PHP, however almost all of the posts were on the "Expert" level, and i couldn't understand a single thing (PHP/Jquery beginner here). Hopefully I can get some help.
Once the user selects from the drop down list, the script function will run. I want to get the user's selection from jquery to a php variable. From then, I want to use the user's selection to retrieve data from the database and display values on the same page itself. I'm not getting any output.
EDITED: So this is what I did after looking at the ajax function
AFile.php
<script type="text/javascript"     src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">     
$(document).ready(function() {     
$('#company').change(function(){     
$.ajax({
    type: 'GET',
    url: '<?php echo url_mgt::getTest(); ?>',
    data: 'company_name=' + $('#company').val(),
    success: function(msg) {
      $('#other').html(msg);
}
});
});     
});     
</script>     
</head>     
<body>     
<select id="company" name="company">     
   <option value="Company_A">A</option>     
    <option value="Company_B">B</option>     
    <option value="Company_C">C</option>     
    <option value="Company_D">D</option>     
 </select>     
 <div id="other"></div>
</body>
companyArray.php
<?php 
   require('protect.php'); 
   require_once(dirname(__FILE__) . '\..\controller\company_controller.php');
   require_once(dirname(__FILE__) . '\..\controller\url.php');
   $companyCtrl = new company_controller();
   $compArray = $companyCtrl->retrieveAllCompany(); 
   if($_GET['company_name']) {
     $get_comp = $_GET['company_name'];
     $inSpace = str_replace("_"," ", $get_comp);
    foreach($compArray as $company) {
       $comp_name = $company->getCompanyName();
       if($get_comp == $company) {
        $comp_add = $company->getCompanyAddress();
         echo $comp_add;
        }//end if
     }//end foreach
   } //end if
  ?>
I inspected element, but when i click on the drop down list nothing happens, i doubt its going to the companyArray.php. I also don't think its the url_mgt::getTest() link because ive been using this url pattern throughout the project.
 
     
    