Sachin Shah Sachin Shah - 1 month ago 9
Ajax Question

How to pass multiple parameters in ajax?

How can I pass multiple Parameter ??? In tempid if id is 1 and remove is is 8 then I got the display :


For input string: "8,tempid=1"


function removecall(remove_member)
{
alert("Remove : "+remove_member);
var teamid = document.getElementById('team_id_hide').value;
alert(teamid);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("manage_team_div").innerHTML = this.responseText;
}
};
xhttp.open("GET", "Remove_Member?member="+remove_member+"tempid="+teamid, true);
xhttp.send();
}

Answer

You should change it as code below shows (include '&').You have to use it every time that you need to add a new parameter:

xhttp.open("GET", "Remove_Member?member="+remove_member+"&tempid="+teamid, true);