I have this div area in my index and I want to use it as a button (for graphical issues) and when this button is cliked I want it to send this value to php file and I want to return some values according to this value. Here is what I've done this far but it didn't work at all.
this is my output.php (index)
<script src="http://ift.tt/1APuVEV"></script>
<script type="text/javascript">
int sayac = 1;
$(document).delegate("#klikme", "click", function() {
$.post('sayac.php',{"komut": sayac }, function(data){
$('#output').html(data);
});
sayac = sayac + 1;
});
</script>
<div id = "klikme">
KLİK ME!
</div>
<div id = "output">
<?php include 'sayac.php'?>
</div>
sayac.php
<?php
if(isset($_POST["komut"]))
{
switch($_POST["komut"])
{
case "1":
echo "This is one";
break;
case "2":
echo "This is two";
default:
echo "Something is wrong";
break;
}
}
return false;
?>
Aucun commentaire:
Enregistrer un commentaire