• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Javascript debugging problem

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
jimdgar2
Asked:
jimdgar2
1 Solution
 
leakim971PluritechnicianCommented:
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
 
mcnuteCommented:
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
 
jimdgar2Author Commented:
I'd completely forgotten about this simple fix, and of course it works.

Thanks a lot!
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now