function call_ajax(divId,MyID,functionto_call)
{
var xhttp = new XMLHttpRequest();
xhttp.onload = function() {
// insert responseText into divID object
document.getElementById(divId).innerHTML = this.responseText;
// Call function when AJAX info arrived
functionto_call();
};
xhttp.open("GET", "get_list.php?id="+MyID, true); // Call with parameter read using $_REQUEST[]
xhttp.send();
}
When you want to send a string using JavaScript to a PHP page including special characters use the following functions:
In the calling page using JavaScript:
encodeURI(string to send)
In the reciving page using PHP decode the string using:
urlencode ($_REQUST[''])