I hope this is the right place for this question. I have a function which takes two arguments that are coming from a mysql database and stored in a php variable. the first argument is an int and the second argument is a string. These variables are passed to my javascript function, but when the function is called the first argument is correct but the second argument is undefined and my browser breaks into debug mode.
This is part of my php code that calls the javascript function:
"<td><a href='javascript: confirmDelete(".$row['users_info_id'].", ".$row['firstname'].")' id='delete'>Delete</a></td>"
This is my javascript function:
function confirmDelete(id, dealer){
alert(id + "<br />" + dealer);
//var answer = confirm("Are you sure you want to delete " + dealer + "?");
//if(answer == true){
//window.location = "process_dealers.php?delete=" + id;
//alert("Dealer has been deleted from the database!");
//}
//else{
//alert("Dealer has not been deleted from the database!");
//}
}
I have commented most of the code out so I can see what is being returned in the alert function. The first argument returns the correct value but the second argument returns the name of the dealer, but as undefined. I have tried everything and spent last night and this moring trying to figure this out. I would greatly appreciate any suggestions.
confirmDeletefunction too? It sounds like you're not passing thedealervalue when calling it.{ }button on the toolbar (or pressCtrl+k).