I am trying to pass a value from a hidden input using ajax but console says whatever im doing is not a function
Uncaught TypeError: "#name".val is not a function page.php:35
which is this line : var name = ("#name").val();
html:
<input type='hidden' value='$newname' id='name'>
ajax:
var name = ("#name").val();
$.ajax({
type: "POST",
url: "declineRequest.php",
data: "name="+name,
success: function(data){
alert("Request Declined!");
}
});
why does the error occur? what did i do wrong? tq.