Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
I'm trying to complete redirect with javascript after flutterwaveinline integration

So I've been trying to complete a redirect in my javascript code but i need to pass the uniqid that's generated with the next page but it's not working i need to know how to pass the parameters to the script.php

  document.addEventListener("DOMContentLoaded", (event) => {
    // Add an event listener for when the user clicks the submit button to pay
    document.getElementById("submit").addEventListener("click", (e) => {
        
        // POST ALL PARAMETERS TO A PHP SCRIPT IN ANOTHER FILE. THAT SCRIPT WILL RECEIVE THE PARAMETERS AND INSERT INTO THE DB.

        // GENERATE YOUR REF WITH JAVASCRIPT.

        var generated_ref = functionToGenerateRef();

        $.post('script.php', {
            name: name,
            email: email,
            generated_ref: generated_ref,
        }, function (res) {

        })

        e.preventDefault();
        const PBFKey = ""; // paste in the public key from your dashboard here
        const txRef = ''+Math.floor((Math.random() * 1000000000) + 1); //Generate a random id for the transaction reference
        const email = document.getElementById('email').value;
        const phone = document.getElementById('phone').value;
        const amount = document.getElementById('amount').value;
        
       console.log('loaded')

        // getpaidSetup is Rave's inline script function. it holds the payment data to pass to Rave.
    getpaidSetup({
        PBFPubKey: PBFKey,
        customer_email: email,
        amount: amount,
        customer_phone: phone,
        currency: "NGN",  // Select the currency. leaving it empty defaults to NGN
        txref: txRef, // Pass your UNIQUE TRANSACTION REFERENCE HERE.
    
        onclose: function() {},
        callback: function(response) {
            flw_ref = response.tx.flwRef;// collect flwRef returned and pass to a server page to complete status check.
            console.log("This is the response returned after a charge", response);
            console.log(response.tx.chargeResponseCode);
            console.log(response.data.status);
            if(response.tx.chargeResponseCode == '00' || response.tx.chargeResponse == '0') {
                location.href="http://localhost/ntdc/validator/?ref=" + generated_ref;
            } else {
            // redirect to a failure page.
            }
        }
      });
    });
});
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda