Ik wil POST data verzenden. Overigens heb ik een nogal aparte fout en op google kon ik de oplossing niet vinden.
Als ik dus op .box druk krijg ik in beeld:"bezig";
Als ik een verkeerde url invul krijg ik fout.
Wat doe ik verkeerd dat ik geen goed krijg?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script src="http://code.jquery.com/jquery-1.7.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
$('.box').on("click",function(){
$.ajax({
type: 'POST',
url: 'js/javascript.php',
data: {test: 'test'},
beforeSend: function(){
$('.box').html('bezig');
},
succes: function(){
$('.box').html('goed');
},
error: function(){
$('.box').html('fout');
}
});
});
});
</script>
<div class="box" style="cursor:pointer;">
Test
</div>
<body>
</body>
</html>js/javascript.php:
<?php
if(isset($_POST['test'])){
echo'test';
}
?>