I am trying to pass a var from jQuery to PHP.
After researching I found the most common suggestion was to do this with Post
with Ajax and store the pos
Try
<script>
$.ajax({
type: "POST",
url: "http://currentpage.com",
data: {variablename:'value'},
dataType: "text", //Available types xml, json, script, html, jsonp, text
success:function(response){
//Returned from server
alert(response);
}
});
</script>
<script>
$.ajax({
type: "POST",
url: "index.php",
data: {var:'value'},
dataType: 'text',
success:function(data){
// Test what is returned from the server
alert(data);
}
});
</script>