In my ajax script below when I do console.log
for duration it returns <select name="duration" id="duration">
instead of the value. I think for this reason my function is not working properly. I am not getting any response back from the PHP page and the loading image keeps on loading.
$(document).ready(function() {
$("#submit").click(function() {
var dataString = {
quantity: $("#quantity").val(),
duration: $("select[name='duration']").val()
};
console.log(duration);
$.ajax({
type: "POST",
dataType : "json",
url: "rent-process.php",
data: dataString,
cache: true,
beforeSend: function(){
$("#submit").hide();
$("#loading-rent").show();
},
success: function(json){
$("#loading-rent").hide();
$("#submit").show();
$(".message").html(json.status).fadeIn();
$('#wallet-av').html('$' + json.wallet);
$('#ref-av').html(json.referrals);
}
});
return false;
});
});