Skip to main content

Using the following code but not working:

Need to hire someone quick to get this working

 

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Redirect Based on Hidden Field</title>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script>
    $(document).ready(function() {
      // Function to get the value of a hidden field by ID
      function getHiddenFieldValue(fieldId) {
        var field = $('#' + fieldId);
        return field.length ? field.val() : null;
      }

      // Function to redirect based on the hidden field value
      function redirectBasedOnHiddenField() {
        var hiddenFieldValue = getHiddenFieldValue('#team');
        if (hiddenFieldValue) {
          var redirectUrl = '';

          // Define your URL mapping based on hidden field values
          switch (hiddenFieldValue) {
            case '2':
              redirectUrl = 'https://approvals.kingcapitalnyc.com/business-funding-10a/';
              break;
            case '3':
              redirectUrl = 'https://approvals.kingcapitalnyc.com/business-funding-10a/';
              break;
            // Add more cases as needed
            default:
              redirectUrl = 'https://approvals.kingcapitalnyc.com/business-funding-10/'; // Default URL if no match found
          }

          // Redirect to the desired URL
          if (redirectUrl) {
            window.location.href = redirectUrl;
          }
        }
      }

      // Call the redirect function on page load
      redirectBasedOnHiddenField();
    });
  </script>
</head>
<body>
  <input type="hidden" id="team" value="2"> <!-- Example hidden field -->
</body>
</html>

Hi @Brett_Rosenblatt

Ready to work on this project! Please reach out to me via email at mdmahinurkhan9@gmail.com or WhatsApp at +8801706000034.

Thanks


Reply