473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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




Expand|Select|Wrap|Line Numbers
  1.  
  2. <html>
  3.  
  4.     <head>
  5.             <title>
  6.                    search
  7.             </title>
  8.  
  9. <link     rel="stylesheet" type="text/css"  href="css/pf.css">
  10. <script type="text/javascript">
  11.  
  12.  
  13.  
  14.     function searchh(){
  15.  
  16.     var st = document.getElementById('se_text');
  17.     alert(st.value);
  18.                     if(window.XMLHttpRequest){
  19. xmlHttp=new XMLHttpRequest();
  20. }else{
  21. xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  22. }
  23.  
  24.                         xmlHttp.onreadystatechange=function(){
  25.                                 if (xmlHttp.readyState==4 && xmlHttp.status==200)
  26.                                 {
  27.                                 var resultt=xmlHttp.responseText;
  28.                                 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       
  29.                                 } }
  30.  
  31.                                 // This st is not passing on to shh.php file                             
  32.                                 xmlHttp.open("GET","shh.php?st=+st",true);                        
  33.                                 //xmlHttp.open("GET","shh.php?st="+st,true);
  34.                                 //xmlHttp.open("GET","shh.php",true);
  35.                                 xmlHttp.send();
  36.  
  37. }
  38. </script>
  39.  
  40.     </head>
  41.  
  42.  
  43.  
  44. <body>
  45.  
  46. <div id="search">
  47.  
  48.    <input type='text' name="stext" id='se_text'   onkeyup='searchh()'/>
  49.  
  50. </div>
  51.  
  52.  
  53. </body>
  54.  
  55.  
  56. </html>
  57.  
  58.  
  59.  
  60. // php file shh.php
  61.  
  62.  
  63.  
  64.  
  65. <?php
  66.  
  67. echo $search=$_GET["st"];
  68.  
  69. ?>
  70.  
  71.  
  72.  
Aug 10 '12 #1
3 2118
Dormilich
8,658 Expert Mod 8TB
check out the difference in the use of the st variable between line #17 and line #32.
Aug 11 '12 #2
ariful alam
185 100+
I think you should use line 33 shown here, not line 32.

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

Hope it's help you. :)
Aug 11 '12 #3
Dormilich
8,658 Expert Mod 8TB
syntax-wise this is correct, but it won’t solve the issue around [object HTMLInputElement].
Aug 11 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
5
by: BVM | last post by:
Hi: I have a problem when sending large email(more than 20Mb) from a web page. I got timeout error. How to overcome this problem? I am thinking to have a thread to send email. Once the thread...
7
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
4
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. --->...
3
by: Michael | last post by:
Hi, If I use SQL Server to store session state, whenever I call Session is there a call to SQL Server? Even if I call Session a few times in the same Web page, or even the same code block? ...
4
by: David Hirschfield | last post by:
I have a pair of programs which trade python data back and forth by pickling up lists of objects on one side (using pickle.HIGHEST_PROTOCOL), and sending that data over a TCP socket connection to...
5
by: Navin Mishra | last post by:
Hi, In load test of our .NET 2.0 socket application on Win2003 server, we are seeing sometimes WSEWOULDBLOCK error when sending data to clients. We are using synchronoous scokets with...
3
by: iu2 | last post by:
Hi all, I need your professional opinion about this. It is more a general programming dilemma rather then a C++ one, but since the project I write is in C++... We handle big structs of data....
3
by: Mateo | last post by:
(As.Net 1.1 framework!) Hi! So, I have problem as described in subject. Here is source code:
2
Frinavale
by: Frinavale | last post by:
I have a JavaScript class that displays a partially-opaque div over top of the content of another div when an Ajax request is sent to the server. When the request returns, the JavaScript class...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.