Récupération de données via ajax
Bonjour à tous,
Je n'arrive pas à récupérer ma valeur après un POST en Ajax dans un fichier php qui include sur la même page du ajax. J'ai bien vérifier j'envoie bien mes donnée en ajax c'est la réception qui foire.
voilà mon 1er script
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
<?php
// Main function file
include("php_file_tree.php");
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PHP File Tree Demo</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link href="css/default.css" rel="stylesheet" type="text/css" media="screen" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<!-- Makes the file tree(s) expand/collapsae dynamically -->
<script src="php_file_tree.js" type="text/javascript"></script>
<script type="text/javascript">
function analyse(requester){
$.ajax({
url: "iframe.php",
type:"POST",
data:{
"p":requester,
},
success: function() {
alert(requester);
}
});
}
</script>
</head>
<body>
<?php
echo php_file_tree("/var/lib/tomcat7/webapps/DC3Reporting/reportingDc3", "javascript: analyse('[link]');");
include_once('iframe.php');
?>
</body>
</html> |
Mon fichier iframe.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<?php
if(isset($_POST['p'])){
$rest = $_POST['p'];
echo $rest;
?>
<iframe id="frame" src="http://localhost:8080/DC3Reporting/frameset?__report=<?php echo $rest;?>&sample=my+parameter" height="100%" width="100%">
<?php
}
else var_dump('de');
?> |
je vous remercie d'avance