Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function postNS(e) {
- var email = $("input[type*='email']").val();
- var phone = $("input[type*='tel']").val();
- var topic = $(".content-box .form-group").eq(2).find("input").val();
- var form = JSON.stringify({
- email: email,
- description: topic,
- phone: phone,
- }
- );
- //metoda konwertująca stringi do jsona
- var url = 'sm_register2.php';
- //url do php'a, który obsługuje wysyłkę do SM.
- // e.preventDefault(); - jeżeli nie chcemy odświeżać strony
- $.ajax({
- type: "POST",
- url: url,
- headers:
- {
- 'Access-Control-Allow-Origin': '*',
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- },
- dataType: "json",
- data: form,
- success: function (data) {},
- error: function (data)
- {
- console.log("cos poszlo nie tak");
- }
- });
- }
- //zdarzenie na przycisk
- $(".primary-action").on('submit', function (e) { //co wywołuje wysyłkę do SM
- postNS(e);
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement