Im trying to submit user register information with AJAX like this:
<script>
$("#submit_btn").click(function() {
event.preventDefault();
var supplied_username = $('#desired_username').val();
var password = $('#password').val();
var email_address = $('#email_address').val();
$.post("register", { desired_username: desired_username, password: password, email_address: email_address } ,
function(data){
$('body').append(data);
});
});
</script>
The return data is simply a string of text (i.e. Success! or Register problem….). I think that the script must be infinitely looping somehow but Im not sure where or why. The backend works perfectly when I pass normal POST data to it without AJAX. That is why I think it must be a problem with the client side. Any ideas what could be going on here?
I think you’ve left out some stuff. I think the code below is what you’re looking for