Click here to Skip to main content
15,913,941 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
var xmlhttp;
		if(window.XMLHttpRequest)
		{
			xmlhttp=new XMLHttpRequest();
		}
		xmlhttp.onreadystatechange=function()
		{
			if(xmlhttp.readyState==4 && xmlhttp.readyState==200)
			{
				alert(xmlhttp.responseText);
			}
		}
		xmlhttp.open(GET,"signupin.php",true);
		xmlhttp.send();


signupin.php

echo("hello");

the code should alert hello

where is the problem?
Posted
Comments
OriginalGriff 18-Aug-13 2:52am    
Don't post a new question to add information - use the "Improve question" widget instead.

I have deleted the "Spare" version.
bhawin parkeria 18-Aug-13 3:17am    
okk thanks for that, but can you solve my problem
Use debugger to check line by line what is really happening.

If you do that, you will definitely get the idea.
enhzflep 18-Aug-13 13:12pm    
This can never equate to true..

if (xmlhttp.readyState==4 && xmlhttp.readyState==200)

How do you expect 1 variable to hold 2 values at once? We don't have quantum computers yet, you know!
bhawin parkeria 20-Aug-13 16:44pm    
i didn't wrote this of my own , i copied it from w3schools.com and its working fine

only this time i got problem

1 solution

Don't go for conventional Ajax request.Try jquery ajax to accomplish this task.

include jquery.js library in your project from JQuery site
Then reference it on your used page
Now make an ajax call as below

JavaScript
$(document).ready(function(){
   $.ajax(function(){
     url:"signupin.php",
     mType:"GET",
     async:"true",
     success:function(){
       alert("Hello");
     }
   });
});

For reference please have a look at jquery documentation from below link
ajax call using JQuery
See the magic!Hope this will help you.
 
Share this answer
 
v2

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