Solved

Javascript debugging problem

Posted on 2013-01-13
3
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

729 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