I am creating a json object in which I am pulling fields from form and then using jquery Ajax POST to send the data. But when I see my network tab after pressing submit I basically get the json headers but all the values that should have been pulled from the form are blank except the values I am hardcoding. Note that my json data also has a nested json of type room.
Below is my jquery part:-
var formData={
"checkInDate": $("#checkInDate").val(),
"checkOutDate": $("#checkOutDate").val(),
"roomsWanted":$("#roomsWanted").val(),
"room":{
roomType: $("input[name=roomType]:checked").val(),
roomProperty:"non-smoking"
}
};
$("#checkAvailabilityForm").submit(function(e){
e.preventDefault();
$.ajax({
type: 'post',
url: '',
dataType: 'json',
data: JSON.stringify(formData),
contentType: 'application/json',
success: function(dataRecieved){
var dataRecieved= $.trim(dataRecieved);
if(dataRecieved === ''){
}else{
}
}
});
});