Is there a way to send a value using the get method?
In JavaScript, we need to use the +
symbol to concatenate strings. But my issue goes beyond this simple problem. If I attempt the following:
Let's say;
var sID = 16;
var rID = 17;
EDIT-2: I actually need the string to be in an open method like in this script.
<script type="text/javascript">
function loadName() {
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
$("#btn_add_friend").attr("title", "xxx");
document.getElementById("btn_add_friend").innerHTML = xmlhttp.responseText;
};
var sID = <?php echo $_SESSION["SES_USER_ID"];?>; //value:16
var rID = <?php echo $profile_owner_id;?>; //value:17
xmlhttp.open("GET", "request.php?sender_id=" + sID + "&receiver_id=" + rID, true);
xmlhttp.send();
}
</script>
When this is added to the browser address line, double quotes appear. I want to avoid seeing double quotes and still be able to use the sID and rID variables. The script works without the variables, but adding them causes it to fail.
The desired format on the browser's address line should be:
/request.php?sender_id=16&receiver_id=17
How can this be resolved?