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

120
Vistas
Wordpress div text value to PHP Plugin and return different value

I have an embedded interview (like a contact form) on WordPress, I use an on click function to set a text value of a div to the name of that interview's input field that has focus.

I have created a PHP plugin who's purpose is to get the name from WordPress and return a definition (hosted on a Notion database).

I do not know how to grab the value from that WordPress div on click (/value change) and pass it to the PHP plugin to use as a filter (key) so that I may be able to return the definition.

$databaseId = "BBB";
$url = "https://api.notion.com/v1/databases/$databaseId/query"; //api endpoint
$token = 'AAAA';
$version = '2021-08-16';
$contentType = "Content-type: application/json";



// value to be gotten from Wordpress
$dataElementName = $_REQUEST['q'];



// ADD INTEGRATION TO GET VALUE



//post data
$data_array =
['filter' =>
[
"property"=>"DataElement",
"title"=>["equals"=>$dataElementName]
]
];



$data = json_encode($data_array);



//intialize cURL
$ch = curl_init();



curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
//below is for posting
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);



curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Remove when push to wordpress
//auth header notionAPI
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token,
'Notion-Version: '.$version,$contentType));



//output
$resp = curl_exec($ch);



//error check
if($e = curl_error($ch))
{
echo $e;
} else
{
$decoded = json_decode($resp, true);
//var_dump($decoded);
//meaning will be passed to Javascript for Output
$meaning = $decoded['results'][0]['properties']['Meaning']['rich_text'][0]['text']['content'];
echo $meaning;
}

curl_close($ch);

Any advice is greatly appreciated.

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