ホーム

JavaScript - How to pass multiple values with ajax

js

      var data = {
                  'email_req' : user_email,
                  'name_req' : user_name,
                  'tel_req' : user_tel
                 };

      var request = $.ajax({
        url: "web.php",
        type: "POST",
        data: data,
      });

      request.done(function(msg) {
        alert( "success" + msg );
      });

      request.fail(function(jqXHR, textStatus) {
        alert( "Request failed: " + textStatus + jqXHR);
      });

php

$from_email = $_POST['email_req'];
$from_name = $_POST['name_req'];
$from_tel = $_POST['tel_req'];

 

Pocket
LinkedIn にシェア



新規webサービスの開発の依頼ならoffテク⭐️

低コストで、Reactなどモダン言語での新規webサービス開発を承ります

-ホーム

Copyright© off , 2020 All Rights Reserved Powered by AFFINGER5.