Javascripts not running on localhost

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

Javascripts not running on localhost

Postby Vman » 19. December 2007 20:36

This is probably an easy fix, but as a novice I will still ask.
I am trying to run a website on my local machine using XAMMP. The site uses MySql and PHP. In the PHP code there are some Javascripts that are used to update the web page when certain radio buttons are selected.
The code works fine on the actual website server (from our hosting company), but the scripts do not run on the localhost. The MySql works fine, the database is accessable ( I did modify the PHP code to use the default "root" username to access the database). Pages that do not have the Javascripts load correctly.
I have checked my intranet security settings, and they allow for scripts to run (the same as my internet security settings). Just to test, I disabled active scripting in my internet security settings, and the production site pages that use the scripts did not update, just like on localhost.
Ares there some configuration settings that I am lacking?

Thanks from a NOOB.
Vman
 
Posts: 5
Joined: 19. December 2007 20:21
Location: Georgetown, Texas

Postby Izzy » 19. December 2007 23:08

JavaScript is a client-side scripting language not a server-side language like php, perl etc. and so there are no configuration settings to worry about - the language is handled by your browser not your server as you have found out by your IE tweaking.

You will need to check your JavaScript for correct syntax or post it here for checking.

You can look in your server's error log, just after you have tried the script that fails, for any possible clues:
xampp\apache\logs\error.log
(Note - Normally if a JavaScript is incorrect then the server simply ignores the whole of that particular JavaScript as if it does not exist without making any note in the server's error.log, so there may not be any clues).

More often than not, if the script has to write to another file, the paths are incorrect - a relative paths issue is indicated if it works on your hosting server but not on your localhost server - but at this stage I can only guess as you have not given any workable detail.


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Javascripts not working

Postby Vman » 20. December 2007 05:33

Here is some of the code. It appears that they are Macromedia Dreamweaver functions:

(code removed on edit to make post more readable)


TIA,

David
Last edited by Vman on 21. December 2007 04:07, edited 1 time in total.
Vman
 
Posts: 5
Joined: 19. December 2007 20:21
Location: Georgetown, Texas

Postby Izzy » 20. December 2007 05:57

What are your hosted server specs?

Is the server using MacroMedia ColdFusion?

What version of php is your hosted web server running as there may be some issues with XAMPP having a much later version of php?

Try switching php to version 4 in XAMPP and then try you local site again.

Double click on:
xampp\php-switch.bat
Select 4 to go to version 4 of php.

Restart Apache.

Run the bat file again to switch back but select 5 this time for php5.

Have you an address so I can check your site on the hosted server?

BTW the paste you made is very difficult to sort out and a complete page that is not working instead of a snippet may be better, then it may be possible to run the file to replicate your issues.

A link to a file share (RapidShare for example) if it is too big to paste here would suffice.


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

JavaScripts not running

Postby Vman » 20. December 2007 14:52

Sorry about the crappy cut and paste. I tried switching to PHP4 but got the same error.
Our host is running PHP 5.2.5 (this is the default), but has PHP4 available as an alternative, but they plan on dropping it in 2008.
Our database is running on MySql 4.0.27, but it also runs fine on the version that comes with XAMMP. They do not support ColdFusion.

Our main website is www.manning-enviro.com. This is the page that I sent the snippet of code from:
http://www.manning-enviro.com/configura ... ?model=PSB

I know that these newbie questions get pretty irritating, and I do thank you for your responses. :D
Vman
 
Posts: 5
Joined: 19. December 2007 20:21
Location: Georgetown, Texas

Postby Izzy » 21. December 2007 00:02

That's fine - no worries.
You could edit that post and delete the snippet just to keep the thread at a reasonable size for reading.

I have downloaded the site and as 'time permits', I will try and replicate what may be contributing to your issue and see if I can give you a solution - I will post back with anything I may find.


===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Thanks

Postby Vman » 21. December 2007 04:11

I edited the code out of the post as suggested. I am hopeful that the issue is some small thing that someone with my level of inexperience would not know to fix. :lol:
Vman
 
Posts: 5
Joined: 19. December 2007 20:21
Location: Georgetown, Texas

Postby Izzy » 22. December 2007 01:00

===========================================
1. The new DeskTopXampp Launch Control for XAMPP / XAMPPlite
Posted by Ridgewood available from Ridgewood'sDTX web site

2. Build Rich AJAX Applications - Faster
TIBCO General Interface Pro Edition but FREE and Open Source
Fully working with NO donations required to get a user/password
===========================================
Last edited by Izzy on 24. December 2007 00:25, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby sari42 » 22. December 2007 12:56

since the configurator page works well over the net,
maybe your local php settings differ from the one used on the server ("short open tags" or some such, use phpinfo(); to compare them). You could also open the "Firefox-tools-error console" to find out what goes wrong)
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Error Message

Postby Vman » 24. December 2007 19:16

I suppose that I should have put this out initally, but here is the error message that I get when the page loads from the Firefox error console:

Error: unterminated string literal
Source File: http://localhost/manning/configurator.php?model=PSB
Line: 61, Column: 18
Source Code:
var chargerNONE = " <table width=\"96%\" border=\"0\" cellpadding=\"5\">

Does this help? :?:
Vman
 
Posts: 5
Joined: 19. December 2007 20:21
Location: Georgetown, Texas

Postby sari42 » 24. December 2007 20:52

pretty much self-explanatory:
Error: unterminated string literal
that's why JS isn't executed at all.

FF even tells you where to look:
Source File: http://localhost/manning/configurator.php
Line: 61, Column: 18
Source Code:
var chargerNONE = " <table width=\"96%\" border=\"0\" cellpadding=\"5\"> |<- here you need a closing double-quote

As I said before: it can be due to different settings in php.ini, e.g., "magic_quotes_gpc".
sari42
 
Posts: 800
Joined: 27. November 2005 18:28


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 58 guests