This code is stopping ...I can't get past readyState == 1....
for testing purposes my searchDB.php is simply:
<?php
echo "string blahahahahah blahahaha hahahahhb ahaha";
?>
newK is <input idit is dynamically created with php at the time the
form loads...there up to 28 <input>
that will have the google type search suggestion <div>. srchK is the
<div idgenerated for each corresponding <input>
var xhr;
function XHR() {
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xhr = new ActiveXObject(
"Microsoft.XMLHTTP");
}
return xhr;
}
function searchDB(newK, srchK) {
var http = XHR();
var str = escape($(newK).value);
http.open('POST', 'http://my.url.here/searchDB.php', true);
http.setRequestHeader("Content-type",
"application/x-www-form-urlencoded; charset=UTF-8");
http.onreadystatechange = handleSearchSuggest(http, newK,
srchK);
http.send(str);
}
function handleSearchSuggest(http, newK, srchK) {
var xhttp = http;
if (xhttp.readyState == 4) {
var ss = $(srchK);
ss.innerHTML = '';
var str = xhttp.responseText;//.split("\n");
var estr = eval(str);
alert (estr);
for (var i=0; i < estr.length - 1; i++ ) {
alert (i);
var suggest = '<div
onmouseover="javascript:suggestOver(this):" ';
suggest += 'onmouseout="javascript:suggestOut(this);"
';
suggest +=
'onclick="javascript:setSearch(this.innerHTML, '+newK+', '+srchK+');"
';
suggest += 'class="suggest_link">' + str[i] + '</div>';
ss.innerHTML += suggest;
}
} 2 1666
gp wrote:
This code is stopping ...I can't get past readyState == 1....
for testing purposes my searchDB.php is simply:
<?php
echo "string blahahahahah blahahaha hahahahhb ahaha";
?>
newK is <input idit is dynamically created with php at the time the
form loads...there up to 28 <input>
that will have the google type search suggestion <div>. srchK is the
<div idgenerated for each corresponding <input>
var xhr;
function XHR() {
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xhr = new ActiveXObject(
"Microsoft.XMLHTTP");
}
return xhr;
}
function searchDB(newK, srchK) {
var http = XHR();
var str = escape($(newK).value);
http.open('POST', 'http://my.url.here/searchDB.php', true);
http.setRequestHeader("Content-type",
"application/x-www-form-urlencoded; charset=UTF-8");
http.onreadystatechange = handleSearchSuggest(http, newK,
srchK);
http.send(str);
}
function handleSearchSuggest(http, newK, srchK) {
var xhttp = http;
if (xhttp.readyState == 4) {
var ss = $(srchK);
ss.innerHTML = '';
var str = xhttp.responseText;//.split("\n");
var estr = eval(str);
alert (estr);
for (var i=0; i < estr.length - 1; i++ ) {
alert (i);
var suggest = '<div
onmouseover="javascript:suggestOver(this):" ';
suggest += 'onmouseout="javascript:suggestOut(this);"
';
suggest +=
'onclick="javascript:setSearch(this.innerHTML, '+newK+', '+srchK+');"
';
suggest += 'class="suggest_link">' + str[i] + '</div>';
ss.innerHTML += suggest;
}
}
Hi,
Wrong group.
This is AJAX. Try comp.lang.javascript
Regards,
Erwin Moller
gp wrote:
This code is stopping ...
You're missing the PHP tags "<?php" and "?>"
--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Michael J Whitmore |
last post by:
I am getting tired of losing hair over this. Here is a function that
simply inserts one of three images into a document right before
printing. It is called for every element that has a specific...
|
by: Richard Bell |
last post by:
I would like to open a 'child' window win and check it's ready state.
Unfortunately, when I try to do so, I discover that win.document does
not appear accessable from the parent window, see below....
|
by: Eric Wallstedt |
last post by:
I have a page that "logs" changes made to input fields using ajax to
pass data to a cgi. I use POST and it works fine most of the time (all
the time in IE). But it fails when I get the data from...
|
by: coolvirus |
last post by:
I'm using the XMLHTTPRequest JavaScript object to fetch updated info
from the server.
The problem I'm having occurs on Windows 2000/IE 6. There is a very
long pause on readyState 3 (close to a...
|
by: gp |
last post by:
This code is stopping ...I can't get past readyState == 1....
for testing purposes my searchDB.php is simply:
<?php
echo "string blahahahahah blahahaha hahahahhb ahaha";
?>
newK is <input...
|
by: Mark Knochen |
last post by:
Hi, i have a little problem with ajax.
The follow functions are in my site:
function sndReq(ID,divID)
{
resObjekt.open('get','inc/inc_change_pagelogo.php?ID='+ID,true);...
|
by: iporter |
last post by:
I have several functions with code along the lines of:
var xmlDoc = requestXML("ajax.asp?SP=SelectRelatedTags&tag=" +
array);
The requestXML() function includes the code:
var xmlDoc = null;...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |