I am having some trouble posting data through AJAX. I created a small save script which determines in which table a POST must be saved (I am using a different form for each table):
$(function()
{
$( "#tabs" ).tabs().find( ".ui-tabs-nav" ).sortable({ axis: "x" });
});
function save(target)
{
switch(target)
{
case "praktijk":
$.ajax({ url: 'webscripts/admin/opslaan.php?type=praktijk',
type: 'POST',
data: $("#tabs-2").find('form').serialize(),
success: function(){
alert("gegevens opgeslagen!");
$('#popup').dialog('close');
}
});
break;
case "persoonlijk":
$.ajax({
url: 'webscripts/admin/opslaan.php?type=persoonlijk',
type: 'POST',
data: $("#tabs-1").find('form').serialize(),
success: function(){
alert("gegevens opgeslagen!");
$('#popup').dialog('close');
}
});
break;
case "vragen":
$.ajax({
url: 'webscripts/admin/opslaan.php?type=vragen',
type: 'POST',
data: $('#tabs-3').find('form').serialize(),
success: function(){
alert("gegevens opgeslagen!");
$('#popup').dialog('close');
}
});
break;
}
}
as you can see, I next determine it for the PHP script by using a GET variable that says which table it needs to save it in. But this doesn't work. The script appears to be crashing at this point. I am not sure where exactly it crashes.. the Firebug terminal doesn't show any obvious errors.
Does somebody know why it doesn't work?