Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<html>
<head>
<script>
function showUser(str,st1)
{
if (str=="" AND st1=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }

xmlhttp.open("GET","http://www.tndte.com/Result/Default2.aspx?Value="+str"regul="+st,true);
xmlhttp.send();
}
</script>
</head>
<body>
<center>
<form>
Enter the Register No: &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="reg"/><br /><br />
<input type="radio" value="K"  name="s1" >K/L/R/O/N-scheme &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" value="J" name="s1" >J/C/D/G-scheme
<br /><br />
<input type="submit" value="View" name="submit" id="valuebtn" onClick="oload()" />
</form>
</center>

<br>
<div id="txtHint"><b>Person info will be listed here.</b></div>

</body>
<script type="text/javascript">
function oload(){
    document.getElementById('valuebtn').onclick = function() {
    var s = document.getElementById('reg').value;
    var ss = document.getElementById('s1').value;
    showUser(s,ss);
    }
}
</script>
</html>


The above program is written for checking result myself with the help of original website. with the help of ajax XMLHttpRequest, am passing the values over function. but it not response. can any one help me.?
Posted
Updated 15-Mar-13 9:06am
v2
Comments
ZurdoDev 15-Mar-13 15:06pm    
What? I don't understand where you are stuck.
hari301 15-Mar-13 15:20pm    
the program didn't response and Unexpected string error below the line of "xmlhttp.open("GET","http://www.tndte.com/Result/Default2.aspx?Value="+str"&regul="+st1,true);"
while i run the program
Prasad Khandekar 15-Mar-13 16:47pm    
Hello,

I think I have answered your earlier question on the same lines.

Regards,
hari301 15-Mar-13 17:14pm    
i tired to run this program, and am not expert in ajax, just a beginner. somewat i learned from cross domain request using XMLHttpRequest. but url doesn't return the page to div content.
Chinmaya C 15-Mar-13 22:34pm    
there are 3 observations:

1.
if (str=="" AND st1=="")
in the above line AND is invalid instead you should use && operator.

2.
xmlhttp.open("GET","http://www.tndte.com/Result/Default2.aspx?Value="+str"regul="+st,true);
here parameters are not properly given, rather you should write as follows:
xmlhttp.open("GET","http://www.tndte.com/Result/Default2.aspx?Value="+str+"®ul="+st,true);

3.
var s = document.getElementById('reg').value;
var ss = document.getElementById('s1').value;

where as in the html design you don't have any control with id 'reg' and 's1'. you have assigned name to the controls but ids are not given.
<input type="text" name="reg"/>

please correct these and try to invoke.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900