cant take function argument in a variable name mytext
html code is below
<a id="tod" href="" onclick="today(a)" ><i class="fa fa-calendar"></i>{{this.tod}}</a>
javascript code is below
$(document).ready(function today(a){
var mytext = a;
$('#tod').click(function(event){
event.preventDefault();
$.ajax({
url:"/ajaxdemo",
data:{text:mytext},
method:"POST",
success: function(res){
alert(res.from)
},
error: function(err){
console.log(err)
}
})
})
})