Sending request to server and data is not passing on

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Humaira
    New Member
    • Aug 2012
    • 4

    Sending request to server and data is not passing on

    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 ..




    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"];
    
    ?>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    check out the difference in the use of the st variable between line #17 and line #32.

    Comment

    • ariful alam
      New Member
      • Jan 2011
      • 185

      #3
      I think you should use line 33 shown here, not line 32.

      moreover if you are using IE, then check the Microsoft.XMLHT TP version as there are 4/5 versions of Microsoft.XMLHT TP.

      Hope it's help you. :)

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        syntax-wise this is correct, but it won’t solve the issue around [object HTMLInputElemen t].

        Comment

        Working...