Solved

Javascript debugging problem

Posted on 2013-01-13
3
254 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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-…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to dynamically set the form action using jQuery.

864 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

21 Experts available now in Live!

Get 1:1 Help Now