I'm trying to pass-trough a php variable with javascript to another php page.
I know it sounds over complicated but i cant use a regular php form and use the POST method because it needs to get pass-through when the page loads.
So i thought this should be possible with javascript/ajax/jquery etc and i know its possible so i thought lets try it with jQuery.post ( http://api.jquery.com/jQuery.post/)
This is what i got so far:
On post.php
Code:
<script type="text/javascript">
function postTest() {
$.post("test.php", {testString: "11"}, function(data) {}
);
}
</script>
</head>
<body onLoad="getInfo()">
on test.php
Code:
<?php
$testString = $_POST['testString'];
echo $testString;
?>
So i need help with this jQuery.post thing because i keep getting no results. Anyone who has experience with this sort of things because i have no clue what i'm doing wrong.
|