'ob_get_clean() remove value of input
console.log(ab_id_transakce); return empty variable because there is in php ob_get_clean(). Im novice so i dont understand what this doing. If i remove line with ob_get_clean() ab_id_transakce have correct variable from form input.
How to make function affilate() works also with ob_get_clean()?
<?php
ob_start();
?>
<div class="form-wrapper">
<input type="email" name="email" id="email" placeholder="E-mail *" class="required">
<button type="submit" class="full-width secondary submit-form" onclick="affilate()"><span class="outer-no-height align-center"><span class="middle"><i class="ct-icon-envelope"></i></span><span class="middle">Send</span></span></button>
</form></div>
<script>
function affilate() {
var ab_instance = "xxxx";
var ab_kampan = 3;
var ab_cena = 1;
var ab_id_transakce = document.getElementById("email").value;
console.log(ab_id_transakce);
var script_tag = document.createElement("script");
script_tag.src = "https://xxxx.cz/t3.js";
script_tag.type = "text/javascript";
script_tag.async = true;
script_tag.defer = true;
document.head.appendChild(script_tag);
}
</script>
</div>
<?php
$html_form = ob_get_clean();
?>
<div class="something">
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
