how do I get this ajax value #name and store it in a php variable? what i have done is put it in a HTML.
<p id="name"></p>
setInterval(function(){
$.ajax({
url:"count.php",
type:"GET",
async:true,
cache:false,
success:function(count)
{
$("#name").html(count);
}
});
},1000);
Use data
to pass the variable to server. i.e. to count.php
<p id="name"></p>
setInterval(function(){
var name=$("#name").val();
$.ajax({
url:"count.php",
data:{name:name},
type:"GET",
async:true,
cache:false,
success:function(count)
{
var res = $.parseJSON(count);
var result= res.name;
$("#name").html(result);
}
});
},1000);
And in count.php
$name=$_GET['name'];
echo json_encode(array('status'=>TRUE,'name'=>$name));die;