I’ve created an ajax sign up form using jquery to a PHP backend. My question is whether it’s prudent to leave the form attribute action=””, that is between blank quotation marks and let the ajax interface handle everything. Are there any pitfalls to this method if I’m not interested in users with javascript turned off?
$(‘#signUp’).bind(‘click’, function(event) {
event.preventDefault();
…form validation…
$.ajax({
type: ‘POST’,
url: ‘../formToProcess/processor.php’,
data: enlistee,
success: function() {
});
Since you are already using the Form tag, having the page degrade gracefully won’t kill you. Especially since all you need to do is point the action attribute to the same url and reuse the logic you already have in the backend. But if you really don’t care about graceful degradation, it won’t make any difference aside from the browser trying to send the form data to a non-existent url.