Solved

Javascript debugging problem

Posted on 2013-01-13
3
256 Views
Last Modified: 2013-01-14
I've run into a rather bizarre javascript problem which I'm unable to resolve after many hours of work. Any insights/suggestions would be greatly appreciated.

I have an application running on a fairly standard LAMP stack on a hosted server. The App runs fine and has run fine for many months through numerous code updates. I also have a mirror of the App on the same server which I use for debug. The php,js,css code is written on my desktop (Windows 7 64-bit) with Netbeans IDE and then loaded to the server with Filezilla. I occasionally debug on my laptop (Windows 7 32-bit) and upload from there. Desktop & laptop source files are synched every couple of days.

Here's the bizarre part. I have a common .js file which contains most of the functions used by various php pages. A few days ago I started getting "Syntax error: Unexpected end of input" in Chrome debugger. OK, missing bracket or paren, right? I spent hours going through this .js file with a fine-tooth comb, running Firebug, etc., but could not find any missing ), }, etc.

I then downloaded the .js file from the working App on the server to my desktop, then uploaded it back to the debug environment. Still getting the error. WTF? More hours going through the code with no luck.

I then uploaded the same .js file from my laptop to the debug environment. The error went away. So, I downloaded the file from the (working) debug environment to my desktop, then back up to the debug environment. Two simple filezilla transfers. The error came back.

I'm at my wit's end. Running diff on the various versions of this js file shows they all match. The byte sizes and datestamps are the same. Yet when I upload this file from my laptop there's no error and uploaded from my desktop gives the syntax error, every time.

Any suggestions???
0
Comment
Question by:jimdgar2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38772903
Open the javascript file with your browser : http//www.yoursite.com/path/to/js/yourfile.js
copy/paste the javascript to a notepad and save it to your drive. Try to run with this version
0
 
LVL 11

Expert Comment

by:mcnute
ID: 38774094
It could be a encoding problem. On my mac, all textfiles I download via FTP become MacRoman even if the transfer is utf-8. So I always keep an eye on the encoding in my texteditor and switch it back to utf-8. I always recommend you to transfer files in binary mode so the original file structure remains intact.

That's the issues I can think of, but not sure if that is your issue.
0
 

Author Closing Comment

by:jimdgar2
ID: 38774324
I'd completely forgotten about this simple fix, and of course it works.

Thanks a lot!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now