从服务器到客户端调用变量时出现问题

时间:2019-07-10 09:47:25

标签: php ajax

我想学习ajax。 基本上我开始理解它,但是我有一个问题

这是我的js代码

$('#click').on('click',function () {
     var a="good";
     $.ajax({
       url:'/ggg.php',
       method:'post',
       data:{
           info:a
       },
       success:display_data
     })
});

这是我的html代码

<input type="submit" value="do it" id="click">

这是我的php代码

<?php
   echo $_POST['info'];

这就是我在console.log中看到的 enter image description here

应该出现“好”一词

1 个答案:

答案 0 :(得分:3)

使用public struct AnyPublisher<Output, Failure> where Failure : Error { /// Creates a type-erasing publisher to wrap the provided publisher. /// /// - Parameters: /// - publisher: A publisher to wrap with a type-eraser. @inlinable public init<P>(_ publisher: P) where Output == P.Output, Failure == P.Failure, P : Publisher } 代替type。另外method可能是一个函数。

success

Reference