第一个页面
这里主要是ajax,触发函数你谁便写
//监听提交
form.on('submit(butdemo2)', function(data) {
element.progress('schedule', '100%')
var url = '<?php echo get_template_directory_uri() . "/googlesheet/sheet-quickstart.php"; ?>'
$.ajax({
type: "post",
url: url,
async: false,
data: JSON.stringify(data.field),
contentType: "application/json; charset=utf-8",
dataType: "text",
success: function(result) {
debugger
layer.alert(JSON.stringify(result), {
title: '成功返回的信息'
})
}
});
// layer.alert(JSON.stringify(data.field), {
// title: '最终的提交信息'
// })
return false;
});
第二个页面接收的代码
//拿到上个页面中传入的数据
$request = @file_get_contents('php://input');
$json_data = json_decode($request, true);
//通过解析json拿到每一个值
$home = $json_data["home"];
$homeType = $json_data["homeType"];
$roof = $json_data["roof"];
$electricity = $json_data["Electricity"];
$postalCode = $json_data["postalCode"];
$firstName = $json_data["firstName"];
$lastName = $json_data["lastName"];
$email = $json_data["email"];
$phone = $json_data["phone"];