Я разрабатываю php-приложение для создания информации о пользователе.Я использую jquery ajax для вызова php-сервера, но попадание не произошло.Ниже приведен мой код,
$.ajax({
url: "create.php",
type: "POST",
dataType: "json",
contentType: "application/json",
data: datastring,
cache: false,
success: function (response) {
alert( JSON.stringify(response) );
},
error: function(jqXHR, textStatus, errorThrown) {
alert(errorThrown);
}
});
И мой php-файл,
try {
$data = json_decode(file_get_contents('php://input'), true);
$name = $data["name"];
$email = $data['email'];
$mobile = $data['mobile'];
$stmt = $connection->prepare("query");
$stmt->execute();
$stmt->close();
} catch (Exception $e) {
$msg = array("status" =>0 , "msg" => $e->errorMessage());
}
Пожалуйста, кто-нибудь поможет мне решить эту проблему.
