i want to get data form database using ajax, but it doesn’t work. what should i change?
function getdata()
{
alert();
$.ajax
({
type:'post',
url:'view.php',
data:{
num: "num",
name : "name",
univ : "univ",
ex: "ex",
line : "line"
},
success: function(response)
{
alert(response);
// if (response!=""){
// $("#table").html(response);
// }
}
});
}
and this is the button
<input type="submit" name="submit" onclick="getdata()" value="Submit"/>
the error called “ajax is not a function”. thank you
2
Answers
What happens when you make the same request with a tool such as postman?
We’re going to need a little more context to form be helpful.
A little demo to show that it basically works once you include jQuery: