как перенаправить запрос на определенную страницу PHP с помощью AJAX вызова, ниже мой код структурыКак перенаправить запрос на указанную страницу php с помощью ajax-звонка?
index.html
<html>
<script>
function shift(str)
{
$.ajax({
url: 'destination.php',
type:'POST',
data: {q:str}
}).done(function(data) {
$("#result").html(data);
});
return false;
}
</script>
<body>
<input type='button' value='test' onclick="shift('test');">
<div id='result'></div>
</html>
destination.php
<?php
$string=$_REQUEST['q'];
if($string=="something")
{
header('something.php');
}
else
{
echo "test";
}
?>
это моя структура кода, если вывешенная строка такая же, как и заголовок funtion, должен работать иначе, чем что-то, но funstion заголовка не работает через ajax
http://stackoverflow.com/questions/20975546/php-header- doesnt-redirects-after-ajax-is-called http://stackoverflow.com/questions/18745669/ajax-php-headerlocation – smarber
Это может быть полезно. –