Select is empty when I pass to PHP
Hi,
I am using below code to read the value from SELECT and pass it to PHP then get back the response. It's working perfectly when I change
$request_category = $_GET['cboRequest'] to
$request_category = 2 so the problem is at the value passing level
Can you help please?
- $( "#cboRequest" ).change(function() {
- $.ajax({
- type: 'GET',
- url: "get_request_processing_period.php",
- // dataType: "json",
- data: $(this).find('option:selected').val(),
- success: function(response)
- {
- alert(response);
- // data = response;
- // return response;
- },
- error: function(jq,status,message)
- {
- alert('A jQuery error has occurred. Status: ' + status + ' - Message: ' + message);
- }
- });
- });
and this my PHP:
- <?php
- include('./includes/php_header.php');
- include($_SESSION["bluefile_absolute_path"] . '/includes/session_expiry.php');
- include($_SESSION["bluefile_absolute_path"] . '/includes/connect2db.php');
- include($_SESSION["bluefile_absolute_path"] . '/PHPMailer/class.phpmailer.php');
-
- $session_expiry->check_for_session_expiry();
-
- $request_category = $_GET['cboRequest'];
- // $request_category = 2;
-
- $mysql_query = $mysql_connection->prepare('CALL get_request_processing_period(:param_request_category)');
- $mysql_query->bindParam(':param_request_category', $request_category, PDO::PARAM_STR);
-
- $mysql_query->execute();
-
- while($mysql_row = $mysql_query->fetch())
- {
- $processing_days = $mysql_row["processing_period_in_days"];
- }
-
- echo $processing_days;
-
- return $processing_days;
-
- // include($_SESSION["bluefile_absolute_path"] . '/includes/php_footer.php');
- ?>