I know there are several threads about this topic but I couldn't find one to fit my needs.
I'm simply trying to sand an form asynchronous using the jQueryFormPlugin.
I've got this basic form in index.php
<form id="test_form" action="http://127.0.0.1/MwebCms/index.php?admin=1&p=navigation&add=1" method="POST">
<table>
<tr>
<td>Title</td>
<td><input type="text" name="title"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Speichern" name="submit"></td>
</tr>
</table>
</form>
Now after including Jquery and the Jquery form plugin I added this in my JavaScript file:
$(document).ready(function() {
$('#test_form').ajaxForm(function() {
alert("test");
});
});
Now that's all fine and dandy, but if I now check in index.php for:
echo $_POST["title"];
It will never be set.
What am I doing wrong or is my basic understanding of the jqueryFormPlugin completely wrong at all?
I found the mistake I made:
The $_POST was sent alright, but it wasn't displayed. After changing the jquery to the following:
$(document).ready(function() {
$('form').ajaxForm(function(data) {
$("body").html(data);
});
});
It all worked properly.