I have a Java script named “modifymember.js”
If contains a function named “function showmember(str)”.
This function calls file “getmemberlastname.php” passing it a string with the member’s last name as a parameter
The function code looks like this:
function showmember(str)
{
if(str.length == 0)
{
return;
}
else
{
var xmlhttp = new XMLHttpRequest();
var rtn = "getmemberlastname.php?q=" + str;
xmlhttp.onreadystatechange = function()
{
alert("this.readyState = " + this.readyState + " this.status = " + this.status);
if (this.readyState == 4 && this.status == 200)
{
var responsedata = jQuery.parseJSON(this.responseText);
document.getElementById("userid").value = responsedata[1];
document.getElementById("lastname1").value = responsedata[3];
document.getElementById("firstname1").value = responsedata[4];
…….
}
}
xmlhttp.open("PUT", rtn, true);
xmlhttp.send();
}
When the str contains an apostrophe getmemberlastname.php does not get called.
Without an apostrophe it does get called and works correctly.