I want to pass information through a Jquery scripts onto a php file. I don't want it to be handled by a form, I just want it to grab it from the URL and send it to the php file.
Lets say I typ in this URL:
index.html?info=1
I want that to be passed by the script so it can be prossed.
HTML:
<script type="text/javascript">
$(document).ready(function(){
var j = jQuery.noConflict();
j(document).ready(function()
{
j(".refresh").everyTime(1000,function(i){
j.ajax({
url: "info.php?info=<?php echo $_GET['info']; ?>",
cache: false,
success: function(html){
j(".refresh").html(html);
}
})
})
});
});
</script>
</head>
<body>
<div class="refresh">This will get Refreshed in 10 Seconds</div>
PHP:
<?php
$info = $_GET['info'];
if($info=='1')
{
?>
passing works.
<?php
}
?>
So as you can see I tried this:
url: "refresh.php?info=<?php echo $_GET['info']; ?>",
But that doesn't work. Just to wrap it up. I want to typ in an URL and retrieve the GET data from it. I dont want to retrieve it by having a form sendin an GET method.
I tried multiple things but they all turned out to be form based But like I said, Im redirecting the user to the page with set information depending on the users state. So the info must be taken purly out of the URL
Code:
Type: 'GET',
URL: 'info.php',
Data: 'info.php' + $('#input-field-which-i-dont-want').vall()
If you have any questions, please feel free to ask away.
Thanks in advance.