Callback adds new field to a form and...
Hello,
I have a problem. I have a form where I add a field on ajax's call back but when I submit the form it won't the new field's value:
$(document).ready(function() {
$("#submit").on('click', function(){
var datastring = $("#listingForm").serialize();
$.ajax({
type: "POST",
url: "/member/submit_listing/",
data: datastring,
success: function(data) {
console.log(data);
},
error: function(){
alert('error handing here');
}
});
return false;
});
$( "#parent_cat" ).change(function() {
console.log(this.value);
var form_data = {paren_cat: this.value};
$.ajax({
type: "POST",
url: "/member/params/",
data: form_data,
success: function(data) {
if(data!="1") $("#params_div").html(data);
},
error: function(){
alert('error handing here');
}
});
});
Please help!
Thank you!
Link to the site:
http://ads.philippn.com/member/listing_form