【发布时间】:2017-08-27 03:51:07
【问题描述】:
我想通过 AJAX 将错误消息作为来自 PHP 的 JSON 数据发送到表单 - 数字,例如数字代码、短信和类别(错误、警告、成功...)
我想知道我是否可以制作函数,它发送 JSON 标头,回显编码数据并最终处理执行它的 CURRENT FILE。 我知道我可以在全局代码中作为返回,但在函数内部?
例如data.php 包含在 ajax.php 中,返回结束 data.php 的处理并继续 ajax.php:
header(json...)
echo json_encode('enter your name', 'warning');
return;
并且在功能中像:
function a($class, $message){
header(json...)
echo json_encode(array($class, $message));
//End processing ONLY file, where it's executed
}
【问题讨论】:
-
不太清楚你在这里问什么。