Hey there, can you take a look at my code? It seems to be throwing an error when I try to run it.
I'm still learning, so any help would be greatly appreciated!
<script type="text/javascript">
$(function() {
$('#btnRegister').click(function () {
var name = $('#inputFname').val();
var family = $('#inputLname').val();
var username = $('#inputUname').val();
var password = $('#inputPassword').val();
var mobile = $('#inputMobile').val();
var address = $('#inputEmail').val();
if (name !== '' && family !== '') {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Registeration.aspx.cs/InsertUser",
data: "{'FirstName':'" + name + "' , 'LastName' : '" + family + "' , 'UserName' :'" + username + "' , 'Password':'" + password + "', 'Mobile': '" + mobile + "','Address': '" + address + "'}",
dataType: "json",
success: function(data) {
$('#inputFname').value('a');
$('#inputLname').value('a');
$('#inputUname').value('a');
$('#inputPassword').value('a');
$('#inputMobile').value('a');
$('#inputEmail').value('a');
alert("Registration Complete");
},
error: function(result) {
alert("Registration Failed!");
}
});
} else {
alert("Please fill out all fields!");
return false;
}
});
})
</script>