Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,256
Total Threads: 81,169
Total Posts: 566,839
There are 51 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Other Programming Languages :

xmlHttp Problems & ASP

Thread title: xmlHttp Problems & ASP
Closed Thread    
    Thread tools Search this thread Display Modes  
03-01-2008, 06:03 PM
#1
Seraskier is offline Seraskier
Status: I love this place
Join date: Jan 2007
Location: Charlotte
Expertise:
Software:
 
Posts: 542
iTrader: 0 / 0%
 

Seraskier is an unknown quantity at this point

Send a message via AIM to Seraskier Send a message via MSN to Seraskier

  Old  xmlHttp Problems & ASP

Hello,

I do not code in asp, but I am wanting to use it because if I use php pages for my database additions, users can run the file and do basically whatever they want....

I have this code as testing but it doesnt seem to be working...

seems to be as simple as could be, but i dont know what could be the problem.. also im going to expand it more to do what i need...
(been coding in VB.net so im kinda rusty on php, javascript; give me a break please)

index.php
Code:
<script type="text/javascript" src="username.js"></script> 

<form> 
<input type="text" onKeyUp="checkUsername(this.value)">&nbsp;
<span id="response" style="font-size:10px; font-weight:bold"></span>
</form>
username.js
Code:
function checkUsername(str)
{	
	var url = "username.asp";
		url = url + "?username=" + str;
	xmlHttp.onReadyStateChange = stateChanged;
	xmlHttp.Open("GET", url, true);
	xmlHttp.Send(null);
}

function stateChanged() 
{ 
	if (xmlHttp.readyState == 4  && xml.Status == 200)
	{ 
		document.getElementById("response").innerHTML = xmlHttp.responseText;
	}
}
username.asp
Code:
<%
username = request.QueryString("username")

response.Write(username)
%>

hmm.. help please?

Sincerely,
Jordan | Seraskier

03-02-2008, 05:44 PM
#2
schroder is offline schroder
schroder's Avatar
Status: Member
Join date: Nov 2004
Location:
Expertise:
Software:
 
Posts: 159
iTrader: 0 / 0%
 

schroder is on a distinguished road

  Old

Took a little testing, but here is a working copy of the javascript (which seemed to be the only problem). The snippet is below.

The main problems were the xmlHttp object needed to be created and the rest was case sensitivity issues.

Let me know if this works for you. =)

Code:
function checkUsername(str)
{
	var url = "username.asp";
	url = url + "?username=" + str;

	try {
	  xmlHttp = window.XMLHttpRequest?new XMLHttpRequest():
	  new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {
	  // browser doesn't support ajax. handle however you want
	}

	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}

function stateChanged()
{
	if (xmlHttp.readyState == 4  && xmlHttp.status == 200)
	{
		document.getElementById("response").innerHTML = xmlHttp.responseText;
	}
}

03-02-2008, 11:42 PM
#3
Seraskier is offline Seraskier
Status: I love this place
Join date: Jan 2007
Location: Charlotte
Expertise:
Software:
 
Posts: 542
iTrader: 0 / 0%
 

Seraskier is an unknown quantity at this point

Send a message via AIM to Seraskier Send a message via MSN to Seraskier

  Old

ok, got it working long before you posted that, but thank you anyway..

new problem, not even sure if it can be done....

http://www.revonal.com/register.php

index.php
Code:
removed to protect code
register.js
Code:
removed to protect code
basically what im trying to do, is make it open like it does.. but then if they correct something, itll adjust it again to make it the right size; i can get it to work if they answer some right, then they try it. erase it, and try to register itll make it bigger again...
(if that makes any sense at all)

but if they have none correct, and then fix one. it wont move the box's height to match the error box..

possiblity of doing this?

also any cleaning of my code that you could do?
or any work arounds?

please post...

sincerely,
jordan | seraskier

03-03-2008, 03:34 AM
#4
schroder is offline schroder
schroder's Avatar
Status: Member
Join date: Nov 2004
Location:
Expertise:
Software:
 
Posts: 159
iTrader: 0 / 0%
 

schroder is on a distinguished road

  Old

I wasn't able to recreate the problem. Did you already fix it?

I tested it by submitting the form without entering anything (which would cause validation of all fields to fail) then I tried just the username and I didn't see anything wrong.

03-03-2008, 04:34 AM
#5
Seraskier is offline Seraskier
Status: I love this place
Join date: Jan 2007
Location: Charlotte
Expertise:
Software:
 
Posts: 542
iTrader: 0 / 0%
 

Seraskier is an unknown quantity at this point

Send a message via AIM to Seraskier Send a message via MSN to Seraskier

  Old

Originally Posted by schroder View Post
I wasn't able to recreate the problem. Did you already fix it?

I tested it by submitting the form without entering anything (which would cause validation of all fields to fail) then I tried just the username and I didn't see anything wrong.

well, i didnt notice anything wrong..i was just asking how i could turn back around the timer script in order to change the height page vertically to match the error box, i just did a little work around, instead of it doing it gradually it just does it instantly...
doesnt look as good, but it works

was that you who registerd "test"? saw it in my database...

when you submitted everything? did it not let you, or did it not work and totally **** up?

03-04-2008, 12:41 AM
#6
schroder is offline schroder
schroder's Avatar
Status: Member
Join date: Nov 2004
Location:
Expertise:
Software:
 
Posts: 159
iTrader: 0 / 0%
 

schroder is on a distinguished road

  Old

I was the one that submitted "test" info.

The only thing I can think of with the expandMain timer is to reset x to 0 in your form processing function.

Closed Thread    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed