Answer the question
In order to leave comments, you need to log in
How to send data from the calculator on the site?
In general, the site has a calculator in the form of a table.
We enter the data, we see the final cost.
The cost using a script is written to the p tag with the article_cost class,
how can this cost be sent to the mail?
Answer the question
In order to leave comments, you need to log in
In browser:
<p class="article_cost" id="test">213</p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
alert($(".article_cost").html());
$.post(
"/ajaxtest.php",
{
calculated: $(".article_cost").html()
},
onAjaxSuccess
);
</script>
$f=fopen("log.txt","a");
fwrite($f,$_POST['calculated']);
Send to the server (POST request directly or via AJAX), and from the server - already to the mail.
It won't work without a server.
FormData + XMLHttpRequest (ajax), or fetch, or something similar.
Examples: https://developer.mozilla.org/en-US/docs/Web/API/F...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question