Reputation: 453
Can't seem to figure this one out. This is my jQuery:
$('#submit').on("click",function(e){
e.preventDefault();
$.ajax({
type:'POST',
url:'/signup/createuser/',
data:{
email:$('#email').val(),
password:$('#password').val(),
terms_checkbox:$('#terms_checkbox').is(':checked'),
recieve_email_checkbox:$('#recieve_email_checkbox').is(':checked'),
phone_number:$('#phone_number'),
// full_name:$('#full_name'),
csrfmiddlewaretoken:$('input[name=csrfmiddlewaretoken]').val(),
},
success:function(data){
console.log('here');
}
});
});
This is my html:
<input id="full_name" type="text" class="form-control" name="name" placeholder="John Doe" value="">
<input id="phone_number" type="text" class="form-control" name="phone" placeholder="+1(444)444-44444" value="">
If I comment out phone_number - everything works fine. But when I add it - it breaks? This makes me wonder if there is a data limit on POST?
Upvotes: 0
Views: 54
Reputation: 665276
You probably are looking for $('#phone_number').val()
instead of $('#phone_number')
. jQuery will try to serialise the data for you, and it probably fails on the circular references in the jQuery collection object.
Upvotes: 1