hello ... i am new here .. i am having similar problem .. when i am sending request to server .. data is not passing on .. which is in st.. and i tried to make it up with browser by the method GET ,, at opening of XMLHttp..
i dnt knw wat is really wrong here .. i just wish someone can help me on this .. please read the code .. i have mentioned all the mistakes with a comment above or bellow and where the things are getting really weird ..
i dnt knw wat is really wrong here .. i just wish someone can help me on this .. please read the code .. i have mentioned all the mistakes with a comment above or bellow and where the things are getting really weird ..
Code:
<html>
<head>
<title>
search
</title>
<link rel="stylesheet" type="text/css" href="css/pf.css">
<script type="text/javascript">
function searchh(){
var st = document.getElementById('se_text');
alert(st.value);
if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}else{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.onreadystatechange=function(){
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
var resultt=xmlHttp.responseText;
alert(resultt); // here on response the thing displaying is st or [object HTMLInputElement]... y is it st ... it should b watever i have entered on the input box.. Why is it soo st .. ? i just can't solve this
} }
// This st is not passing on to shh.php file
xmlHttp.open("GET","shh.php?st=+st",true);
//xmlHttp.open("GET","shh.php?st="+st,true);
//xmlHttp.open("GET","shh.php",true);
xmlHttp.send();
}
</script>
</head>
<body>
<div id="search">
<input type='text' name="stext" id='se_text' onkeyup='searchh()'/>
</div>
</body>
</html>
// php file shh.php
<?php
echo $search=$_GET["st"];
?>
Comment