Solved

Javascript debugging problem

Posted on 2013-01-13
3
253 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
Comment Utility
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
Comment Utility
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
Comment Utility
I'd completely forgotten about this simple fix, and of course it works.

Thanks a lot!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

15 Experts available now in Live!

Get 1:1 Help Now