Click here to Skip to main content
12,403,811 members (65,726 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: HTML Ajax jQuery
<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 15-Mar-13 9:03am
hari3011.1K
Updated 15-Mar-13 9:06am
RyanDev214.5K
v2
Comments
ryanb31 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_Champatiray 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 15 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100