xmlhttp requests

Problems with the Windows version of XAMPP, questions, comments, and anything related.

xmlhttp requests

Postby bwls@earthlink » 22. July 2010 22:47

This is my first attempt to get AJAX working to a remote host.

Access via xmlhttp request works fine on my local machine but when I attempt to access a php script on remote apache server I do not get access. If I open the remote script in a browser directly I do get the valid xml response so it appears as though the javascript on my local pc can't access a remote host.

The js file is on my local pc and the script I want to execute is on the remote server. There is no DB access in this test. The only change between local and remote is the url parameter in the GET request. For local it is simply the filename and for remote it is "http://server/filename.php".

How do I allow the js to access the remote host?

Thanks,
Bill
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby bwls@earthlink » 23. July 2010 02:49

After further testing I found that it works with IE on the client but Firefox returns a http.result of 0 (zero) not 200.

Still trying to figure this one out.

Thanks,
Bill
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby bwls@earthlink » 23. July 2010 14:05

More information:

The test app simply returns a text string.

When ran in IE8 the script shows my messages like this:

Request status: 1 (loading)
Request status: 2 (loaded)
Request status: 3 (interactive)
Request status: 4 (done)
and then the result text from the server script.

but when ran in FF 3.6.7 I get this:

Request status: 1 (loading)
Request status: 2 (loaded)
Request status: 4 (done)
Status 3 is missing and I do not get the result text.

Any ideas?
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby JonB » 23. July 2010 22:44

No - as this is neither an AJAX or PHP support forum (although many seem to think so)

But good luck anyway

:mrgreen:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xmlhttp requests

Postby bwls@earthlink » 24. July 2010 03:00

My point was that maybe there is an Apache setting that I am missing that would affect Firefox but not IE.

Thanks.
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby JonB » 25. July 2010 22:34

I can offer an insight based on much time spent debugging a very troublesome AJAX driven chat last year (which I finally succeeded with) -

Ask yourself - "where is this executing?" and what part does each element play in the execution?

I (and another Perl professional) spent weeks trying to wrap our heads around all the logic (he gave up) - but the key was 'location, location. location' (just like real estate). hint: I was mistakenedly trying to solve a non-existent server problem (albeit on IIS). Mine did NOT involve differences in execution between browsers - rather problems with missing settings (parameters) and filesextensions for languages.

Before I was merely suggesting that this wasn't the best place to get this kind of an answer, (at least in English - the German boards have more 'places' and topics)

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xmlhttp requests

Postby bwls@earthlink » 26. July 2010 13:41

Just a thought - The server (remote end where script would execute) is running a basic XAMPP installation. Are there any APACHE settings necessary to allow the xmlHttp process to work properly? This still doesn't address why FF fails and IE works but it is a question that may shed some light on the difficulty.

Thanks.
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby JonB » 26. July 2010 14:23

OK - Google "where does Javascript execute"... and "Java vs, Javascript". :shock:

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xmlhttp requests

Postby bwls@earthlink » 26. July 2010 15:34

the javascript is executing on the local PC. (no java) If there is a better way, please let me know and a short example or link would be fantastic.

Thanks.
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby JonB » 26. July 2010 16:03

Right -

The server really plays no part in the execution, other to serve as a source for the javascript code and (at least in the case I was working with) pass an XML file containing parameters. This was Perl, not PHP so the syntax/functions are not the same at all. I'm not that sure you can '2nd hand pass' javascript to a browser (over my head). I'll see if I can get a hint from our 'AJAX guy' (no guarantees). SO - I think you are down to browser issues...

As for examples: googiespell comes to mind. http://orangoo.com/labs/GoogieSpell/
(this is NOT what I debugged - but I have used it and it is integrated into a project I work on)

Sorry I don't have more answers - Good Luck anyway.

:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xmlhttp requests

Postby bwls@earthlink » 26. July 2010 17:52

JonB - thanks for all your help.

I have confirmed that jQuery also will not display a returned string from the problem server. I have uninstalled and re-installed XAMPP with no change. Both straight javascript and jQuery work fine locally. So all I can say is that there must be a setting somewhere that is the culprit. In firebug console I see the response header and it shows the correct number of bytes but there is no response text. Again IE8 works perfectly in all cases. Thanks.
bwls@earthlink
 
Posts: 10
Joined: 22. July 2010 22:36

Re: xmlhttp requests

Postby JonB » 26. July 2010 18:18

my 'opinion' only - it can't be the server - it serves up the same dish of soup to all customers.

The server is asked for an object, unless you have written code that diferentiates the response by the 'agent' (that would be the browsers in this case) its going to dish up either mulligatawny soup, scotch broth, or paella as you requested.

get(mulligatawny_soup) is ALWAYS going to serve the same dish... mulligatawny soup - period. The server is 'serving' just like a waiter. For the most part this is determined by the MIME types and their associations.

The way a server determines the user agent is in the http header response, so absent custom code, the server is very modern, it treats all patrons equally.

I hope this is helpful and useful to you.
:wink:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests