Member Avatar for gamefreak5678

I am trying to pass multiple variables and it is not working. When I click a link, I would like this to execute, but nothing happens. When I'm passing only one variable, this does work. Am I leaving out a part?

Here is the code:

function test(s,g)
 {
 if (window.XMLHttpRequest)
 {
 testThis=new XMLHttpRequest();
 }
 else
 {
 testThis=new ActiveXObject("Microsoft.XMLHTTP");
 }
 testThis.onreadystatechange=function()
 {
 if (testThis.readyState==4 && testThis.status==200)
 {
 document.getElementById("exampleDiv").innerHTML=testThis.responseText;
 }
 }
 testThis.open("GET","something.php?s="+s+"&g="+g,true);
 testThis.send();
 }

Any kind of help is appreciated. Thanks!

Perhaps what you want is testThis.responseXML?

No, probably you need to add "&sid="+Math.random() or something. But I recommend you to use some library for AJAX, many people use jQuery, but that's your choice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.