1

I have an HTML page generated by an objective-C application and I want to load and open it in a local directory (not in a web server). The javascripts jquery.js and jquery.plot.js are stored in the same directory before the page is loaded. I made the HTML page by following closely the examples available on http://flot.googlecode.com/ The scripts are declared in the HTML page as follows :

<script src="jquery.js" language="javascript" type="text/javascript"></script>
<script src="jquery.flot.pack.js" language="javascript" type="text/javascript"></script>

When I open the page, the expected graph (generated by the scripts) doesn't show up and I have the following syntax error in the javascript console :

Uncaught SyntaxError: Unexpected token ILLEGAL 

The script source in the javascript console is made of strange (chinese ?) ideograms which are obviously "unexpected token" if it is what the browser sees. I have the same problem with Chrome, Firefox and Safari. The problem is not systematic because sometimes, it works !. I have made tests with files prepared manually and again it works sometimes only. I have also copied the same file which didn't work in another directory where the jquery scripts were present and, surprise, it worked ! but not always... I have exhausted all my ideas on this problem and your help will be very much appreciated

5
  • You need to wrap any code in your post or else it won't show correctly. Commented Feb 20, 2012 at 14:45
  • 3
    This is your sixth question, you really should be marking things up correctly by now. When you were typing your question, to the right there was a How to Format box. Well worth a read, as are the various bits of information available via the [?] button above the text area. There's also a preview area underneath so you can see how your question will look when it's posted, and of course an "edit" link once you post the question if, on re-reading it (and you did bother, right?) you see that some of the formatting didn't work. Bothering with all this shows respect for other people's time. Commented Feb 20, 2012 at 14:49
  • 1
    Did you propose this edit to add new information? If you log in your can just edit your question which makes much more sense. Commented Feb 20, 2012 at 18:40
  • I'm having the exact same problem. Did you ever find a fix? Commented Nov 28, 2012 at 5:37
  • Salem, try using //cdnjs.cloudflare.com/ajax/libs/flot/0.7/jquery.flot.min.js as your src= attribute. Commented Nov 29, 2012 at 2:09

2 Answers 2

1

Did you copy the JavaScript from an external source? I know I have had problems when copying from JSFiddle for example. Try removing any whitespace and see if that will get rid of the illegal token error.

Sign up to request clarification or add additional context in comments.

1 Comment

The zipped flot library comes from code.google.com/p/flot/downloads. I do not see any whitespaces I could remove
0

I just had this problem and it was because the server on which my javascript was being hosted wasn't configured to send the javascript file with the correct MIME type. See this question.

Instead of fixing my server, I just opted to use a CDN path from cdnjs.com:

//cdnjs.cloudflare.com/ajax/libs/flot/0.7/jquery.flot.min.js

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.