I am trying to use .ajax to validate a form. Nothing happens, and I am not even sure if process.php is being loaded. Here is my code:
$('document').ready(function(){
$('#submit').click(function(){
var request = $.ajax({ url: 'process.php',
data: {"submit":submit,"elements":spanName},
type: 'post',
success: function(output) {
alert(output);
if(output == ""){
alert('user created!');
} else {
alert('bad!');
}
}
});
});
request.fail(function( jqXHR, textStatus ) {
alert( "Request failed: " + textStatus );
});
});
In process.php, I have tried everything from echo, to inserting a record into a database, to returning a value (boolean, or string). There is no error message. The button is clicked, and nothing happens. Am I just missing something?