I have an ajax form and I want to reload the div instead of the whole page, but it isn't working.
This is my handling.js:
$(document).ready(function(){
$('#guideForm').submit(function(){
$.ajax({
type: 'POST',
url: '../includes/handling.php',
data: $(this).serialize()
})
.done(function(data){
$('#guide').load(document.URL + ' #guide');
})
return false;
});
});
this is my handling.php:
if ($_POST['guide']) {
$settings->addGuide($_POST['guide']);
}
EDIT: Formcodes:
<div class="col-md-4">
<h2>test title</h2>
<p class="guids">This is a test text.</p>
<form method="post" id="guideForm">
<input name="guide" value="1" style="positon:absolute; display:none;">
<button class="btn btn-primary">Got it!</button>
</form>
</div>
Can someone help me to figure out what I'm doing wrong?