473,385 Members | 1,337 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,385 software developers and data experts.

Ajax, Firefox keeps saying "waiting for ..."

Hi All

I'm happily creating an Ajaxified web-app. I use Prototype for
encapsulating xml http requests, with method "post". On the backend, I
use PHP, and the replies are eval'd by Javascript. I do not use XML for
data encapsulation.
The only thing that is off nominal is that my Firefox 1.07 (Mac OS-X)
and 1.06 (Linux) have "Waiting for ..." continuously in the status bar.

I know from server debugging and packet sniffing that there is no more
data communication. The server reply has already been handled so that
functionally I have no problems at all. I am just wondering if there is
something I'm doing wrong on the PHP side: the code is this.

function xhr_reply($re){
header("Content-type: text/xml");
print $re;
die;
}

I know it's really php, but it seems to me this is the usenet place for
xml http request type problems.

Thanks for any enlightenment.

Bart
Nov 8 '05 #1
6 2574
Bart van Deenen wrote:
Hi All

I'm happily creating an Ajaxified web-app. I use Prototype for
encapsulating xml http requests, with method "post". On the backend, I
use PHP, and the replies are eval'd by Javascript. I do not use XML for
data encapsulation.
The only thing that is off nominal is that my Firefox 1.07 (Mac OS-X)
and 1.06 (Linux) have "Waiting for ..." continuously in the status bar.
Do you have the prototype onSuccess and onFailure functions defined?
I know from server debugging and packet sniffing that there is no more
data communication. The server reply has already been handled so that
functionally I have no problems at all. I am just wondering if there is
something I'm doing wrong on the PHP side: the code is this.

function xhr_reply($re){
header("Content-type: text/xml");
print $re;
die;
}
where are you calling this function from? You make a call with prototype
to the server with either a GET or POST so when do you read those?

I know it's really php, but it seems to me this is the usenet place for
xml http request type problems.


Have you gotten a really simple example to work? Just send a variable
with GET or POST and have the php just send it back to you. handle
the response with the onSuccess function.

post your ajax call and php function to get a better answer.

chuck
Nov 8 '05 #2
Hi Chuck

chuck <no****@somedomain.com> wrote:
Have you gotten a really simple example to work? Just send a variable
with GET or POST and have the php just send it back to you. handle
the response with the onSuccess function.

post your ajax call and php function to get a better answer.
Thanks for your answer. Unfortunately, it is not reproducible with a
really short example :-( Fortunately now I know it's a bug somewhere in
my app, so I can go looking for it.

My app is quite complicated with multiple xhr's running simultaneously
generated from dynamic data. Maybe one of them is wrongly addressed or
so, and I haven't noticed it up to now.

Greetings

Bart

The stuff below works fine

--------------------- a.html --------------
<html >
<head>

<script language="JavaScript" type="text/javascript" src="prototype.js" </script>


<script type='text/javascript' >

function assignError(e){ $("id_error").innerHTML = e; }
function assignSuccess(e){ $("id_success").innerHTML = e; }

function xhr(){

new Ajax.Request( 'a.php', {
asynchronous: true,
method: "post",
parameters: "test="+$F('id_text'),
onSuccess: function(request) {
assignSuccess(request.responseText);
},
onFailure: function(request) {
assignError(request.responseText);
}
});
}
</script>
</head>
<body >
<div id='id_error' style='background:red'> </div>
<div id='id_success' style='background:#0d0'> </div>

<input type='text' id='id_text' />
<button type='button' onclick='xhr()' >xhr test
</button>
</html>
------------------- a.php -------------------
<?
if ( $_REQUEST['test']) {
header("Content-type: text/xml");
print "hi there ".$_REQUEST['test'];
die;
}
?>
Nov 8 '05 #3


Bart van Deenen wrote:

I'm happily creating an Ajaxified web-app. I use Prototype for
encapsulating xml http requests, with method "post". On the backend, I
use PHP, and the replies are eval'd by Javascript. I do not use XML for
data encapsulation. header("Content-type: text/xml");


Well if you don't use XML why do you set the HTTP response Content-Type
header to text/xml then?
I think you want
header('Content-Type: text/plain');
then or perhaps
header('Content-Type: text/javascript');
I don't think that header causes the problem you see but XMLHttpRequest
will try to parse a text/xml response as XML and you can prevent it from
that useless attempt then by setting a proper Content-Type.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 8 '05 #4
Martin Honnen <ma*******@yahoo.de> wrote:
I don't think that header causes the problem you see but XMLHttpRequest
will try to parse a text/xml response as XML and you can prevent it from
that useless attempt then by setting a proper Content-Type.

You are right, it doesn't matter. This was just the result of my
tinkering with this problem. As I posted in result to chuck, the problem
must be somewhere deeper within my app, because a trivial case doesn't
have the problem.

Bart
Nov 8 '05 #5
Try setting a content length header.

function xhr_reply($re){
header("Content-type: text/plain");
header('Content-length: '.strlen($re));
print $re;
die;

}

Nov 8 '05 #6
Bart van Deenen wrote:
Martin Honnen <ma*******@yahoo.de> wrote:
I don't think that header causes the problem you see but
XMLHttpRequest will try to parse a text/xml response as XML and you
can prevent it from that useless attempt then by setting a proper
Content-Type.

You are right, it doesn't matter. This was just the result of my
tinkering with this problem. As I posted in result to chuck, the
problem must be somewhere deeper within my app, because a trivial
case doesn't have the problem.

Bart


Total newb here but our shop is migrating to web apps using Ajax and I see the
same thing in all of our stuff in Firefox. I have just been assuming that
Firefox is expecting our forms to use a standard submit action and is "waiting"
for that response.


Nov 9 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob | last post by:
Does anybody know what might cause the following message to show up in the SQL Server Error Log?: Time out occurred while waiting for buffer latch type 2, bp 0x12260f80, page (5:77914), stat...
8
by: Don Miller | last post by:
I've been extensively modifying a web application (ASP, COM+) to take advantage of the XMLHTTP object for asynchronous requests (e.g. Ajax) on my dev machine (Win2KPro). I test the application from...
7
by: Larry Bud | last post by:
More of a design question than technical.... combining Ajax technology with ASP... Top portion of the page contains several Select boxes which are dependant upon one another. Ajax handles that...
6
by: blueapricot416 | last post by:
I have some javascript in a standard HTML page that uses the ubiquitous "XMLHttpRequest" to send data to a remote ASP page. If that page "answers back" by sending a string using a simple...
1
by: Tony Lawrence | last post by:
Probably a lot of you here are already old hands at Ajax, but I haven't started doing this yet. Part of the reason was that I really didn't understand where Ajax would be useful to my own site,...
4
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request...
2
by: pe3no | last post by:
Hi, I'm going to create applications PHP + AJAX + Linux + Apache + Postgres. - Other Open Source technologies / Frameworks, etc. also :) Is this book http://www.amazon.com/gp/reader/0471777781...
5
by: Sommer.pde | last post by:
It took me some time to find out when and why this happens. When the window of Internet Explorer is closed with an AJAX call still pending, something funny happens. Do it twice, and you will have...
11
by: Jonathan Wood | last post by:
Can anyone point me to any good resources on adding AJAX to a page once the page has already been created? I know VS2008 has options to add AJAX pages, but I didn't select those options when the...
1
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...
0
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...
0
isladogs
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.