CE Home
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Notices


Advertisements
Reply
 
LinkBack (1) Thread Tools Display Modes

  1 links from elsewhere to this Post. Click to view. #1 (permalink)
Old 11th October 2008, 12:53 PM
CE - Newbie
 
Join Date: 2nd October 2008
I'm a Crazy Computer Science Engineer
Posts: 2
Default ajax doubt

HTML Code:
<html>
<body>
<script type="text/javascript">
function ajaxfunction()
{
var y=document.myform.na.value;
var z=document.myform.time.value;
var x;
try
{
x=new XMLHttpRequest();
}
catch(e)
{
try
{
x=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
x=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
alert("Your browser does not support AJAX :(");
return false;
}
}
}

x.onreadystatechange=function()
{
if(x.readyState==4)
{
document.myform.time.value=x.responseText;
}
}
var url="time.php";
url=url + "?q=" + y ;
url=url + "&sid =" + Math.random();
x.open("GET", url , true);
x.send(null);
}
</script>
<form name="myform">
Name: <input type="text"  name="na"/>
Time: <input type="text" name="time"/>
<input type="button" onclick="ajaxfunction();" name="btn">
</form>
</body>
</html>
this is jus a prog in ajax to check if the username and password are correct???
i jus don get the three lines below:

var url="time.php";
url=url + "?q=" + y ;
url=url + "&sid =" + Math.random();

x.open("GET", url , true);
x.send(null);

how is q assigned the correct value??? of y and wht ll be the variable url while sending??

also i need to attach one more value to the url, it is z here..

in the php code, the stmt
$n=$_GET["q"];
exactly retrieves the value of q and assigns it to n...

so jus say what does that ? and = mean and how they are assigned

thnx in advance

Last edited by The_Big_K; 11th October 2008 at 01:40 PM.
gijoe is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)
Old 14th October 2008, 04:14 PM
CE - Regular Member
 
Join Date: 25th September 2008
I'm a Crazy CSE Engineer
Posts: 65
Thumbs up Re: ajax doubt

Hi gijoe,

This is the line which reads value of name in y
var y=document.myform.na.value;

When you click a submit ajaxfunction is called.

if you write "crazyengineer" in input filed the url formed will be


http://servername/time.php?q=crazyengineer&sid=8948923

sid will have a random number this is just to take care that each time a new url is produced or else there may be a possibility that browser cache will give old values!

Thanks & Regards
Sriram
sriramchandrk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.crazyengineers.com/forum/computer-science-engineering/6257-ajax-doubt.html
Posted By For Type Date
ajax doubt - CrazyEngineers Forum This thread Refback 11th October 2008 01:20 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax Technology pankaj.sharma Computer Science & IT Engineering 1 2nd November 2007 11:44 AM
Difference b/w JSF and AJAX magakamal Computer Science & IT Engineering 1 27th April 2007 01:46 PM
PHP / AJAX experts, anyone? The_Big_K Computer Science & IT Engineering 17 9th November 2006 10:48 AM
AJAX(Asynchronous JavaScripting and XML) Mahesh Computer Science & IT Engineering 2 27th October 2006 05:29 PM
PHP Symfony and AJAX kidakaka Computer Science & IT Engineering 0 19th October 2006 02:37 PM


All times are GMT +5.5. The time now is 12:31 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.

Advertisements