May be a simple question to solve…
On button click I call a function on the include file and parse a function name (b). Why b is not a function ?
I have the following files (only a sample of the issue):
comum.js
function f(b){
var a = eval(b +'();');
}
function a(v){
$.ajax({url:'update.aspx',
data: 'q=5',
success: function(){
f(v);
}
});
}
default.html
<html>
<head>
<title></title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="comum.js"></script>
<script language="JavaScript" type="text/javascript">
$(function(){
$("#me").click(function(){
a('b');
});
});
function b(){
$("#me").attr("disabled","disabled");
}
</script>
</head>
<body>
<input type="button" id="me" value="click me" />
</body>
</html>
Don’t use
eval.Change this:
To this instead:
And then also: