I've got a form, a very long form, and in case people don't get to the end of completing it I'm trying to capture the initial personal data to store and allow someone to follow up from (if the person didn't complete the form). So, I've got some jQuery in place to do this.
jQuery(document).ready(function($){
$('#htel, #email, #dcsfnum').change(function(){
$.post("/includes/saveappform.inc.php", {id: $('#recid').val(), p: $('#afpost').val(), t: $('#aftitle').val(),
f: $('#fname').val(), s: $('#sname').val(), m: $('#afstatus').val(), d: $('#dob').val(),
a1: $('#addr1').val(), a2: $('#addr2').val(), tc: $('#city').val(), c: $('#county').val(),
pc: $('#postco').val(), ht: $('#htel').val(), wt: $('#wtel').val(), mt: $('#mtel').val(),
e: $('#email').val(), nn: $('#ninum').val(), dn: $('#dcsfnum').val()}, function(data) {
if (data) {
$('#recid').val(data);
}
});
});
});
So the idea is when a phone number, email address of their DCSF Number is entered, it triggers the JS to save/update the initial data in a db. The PHP is simple
<?php
require $_SERVER['DOCUMENT_ROOT']."/wp-blog-header.php";
$recid = updateAppFormDB((int)$_POST['id'], $_POST['p'], $_POST['t'], $_POST['f'], $_POST['s'], $_POST['m'],
$_POST['d'], $_POST['a1'], $_POST['a2'], $_POST['tc'], $_POST['c'], $_POST['pc'], $_POST['e'],
$_POST['ht'], $_POST['wt'], $_POST['mt'], $_POST['nn'], $_POST['dn']);
echo $recid;
?>
The updateAppFromDB() function just checks for an ID and updates the db table or inserts as new. Still got some additional security to put in place but you get the idea.
Anyway, I've got the files in the right place, yet I'm getting Firebug reporting a 404 error when my jQuery tries to post to the php file. Yet, it's still running the file, creating the record and returning the record ID. However it's not putting this record ID into the form (so it's continually creating a new record, not updating the existing one.
I don't get it. I've tried post, get (data is too long in reality though), I've moved the file about, and it just doesn't want to return a 200 status.
Am a bit lost

PS. The page is protected on a site but am happy to give the password via PM if someone wants to look for themselves
