Hi Everyone,
I'm basically just trying to submit a form through AJAX and want to show the return of the processing PHP page. The PHP page just validates the input and shows either the errors that occured, or a thank you message to the user. Normally I wouldn't use ajax for it, but in this case the customers setup requires me to.
As simple as that may sound, I can't get it to work.
The jquery (1.4.2) code I'm using:
$(document).ready(function() {
$('#subscription').submit( function() {
var inputdata = $('#subscription').serialize();
alert(inputdata);
$.post("process_form.php", inputdata, function(data) {alert(data);} );
});
});
Firebug just shows:
POST process_form - status: aborted
Another curious observation is that the success handler is actually called, but no responseText is displayed. My apache logs show a 304 http message for the process form, after which it shows another line with statuscode 200 for the form, as if it was redirected back there, whether that is normal AJAX behaviour I don't know.
W3C states here:
If the origin of the URL conveyed by the Location header is same origin with the XMLHttpRequest origin and the redirect does not violate infinite loop precautions, transparently follow the redirect while observing the same-origin request event rules. Otherwise, this is a network error.
But I don't think my request violates any of those.
Anyway, long story short: I'm stuck.
Any help would be very much appreciated and off course I'd be happy to supply any further needed information.
Thank you very much for your time.
All the best,
-G