I am having problems setting the educationflag variable to 1. The problem I am solving is not to call enableEdit.php file if flag is 1.
I want to set the flag to 1 when the control comes in the if condition. Right now the control comes in the if condition but does not set the variable to 1. My code is printed below. I
var educationFlag=0;
function editEducation(class){
//I send education in class variable. So class ='education';
var condition=eval(class+'Flag');
if ( condition == 0 ){
$.ajax({
url: "enableEdit.php",
data: "class="+class,
success: function(msg) {
}
})
eval(class+'Flag'=1);
}
}
Thanks
editEducationfunction with my malicious code in the argument. Ok, got it. Thanks:)(Not that I wouldn't be able to figure this out by viewing your source code directly on your page ... )classin javascript. it's not a keywordeval(), you are almost certainly making a big mistake.eval()is a security risk, it causes performance issues, and it makes your code difficult to debug. But most of all, it is almost never necessary to actually use it: there is always a better way. It is occasionally useful, but never in situations like this.