<? echo htmlspecialchars('<script>....'); ?>
htmlspecialchars(strip_tags(base64_decode($otz["text"])));
$sql = mysql_query("INSERT INTO temp (login, id, date, status) VALUES ('$login', '$id', '$komm', '$time', '0') ");
$data = array(
'status' => 'success',
'redirect' => '/page',
'message' => 'Действие успешно! Ожидайте!'
);
print(json_encode($data));
function nameMethod() {
$.ajax({
url: '/url',
dataType: "json",
type: 'POST',
success: function (response) {
window.setTimeout(function () {
alert(response.message)
}, 2000);
window.location.href = response.redirect;
}
});
}
<button type="button" onclick="nameMethod()">Submit</button>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if(getParameterByName('success')==1) {alert('Успех');}