I have an AJAX program which gets data from the website and posts the info to Facebook. My problem is quite simple. I need to generate HTML in the callback function. Here is a button:
var city = "Beijing";
html+= "<td><input type=button value=FACEBOOK onclick=\"fb("+city+")\"></td>";
document.getElementById("myDiv").innerHTML = html;
Say I have the variable "city", and it has certain value. By generating the button like above, I cannot pass the city to the function fb(city). It even wouldn't invoke that function. However, it works if I remove the parameter.