Given the code below, is it safe to say the id passed in the ajax call below will always be 1 or is there a chance id can be null/undefined?
$('.clickTest').click(function () {
var id = 1;
$.ajax({
type: 'post',
url: "TestClick?id=" + id,
success: function (r) {
console.log('success');
},
error: function (r) {
console.log('error');
}
});
});
>Solution :
It’s going to be 1, but you should use const instead of var.