Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6135527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:29:24+00:00 2026-05-23T17:29:24+00:00

I am running a server on go. When I access the localhost:8888/static/ajax.html , I

  • 0

I am running a server on go. When I access the localhost:8888/static/ajax.html,
I get no errors. But when I just access localhost:8888 I get
an error saying:

“Uncaught SyntaxError: Unexpected
token <“

By default “/” serves ajax.html file, but doing so I don’t get the
expected result. On the other hand on calling /static/ajax.html I am
getting the expected result without any errors.

server.go contains the following :

package main 
import ( 
        "http" 
        "flag" 
) 
//var path = flag.String("storage", "/home/chinmay/work/jstree/", "Set storage directory, use absolute path") 
var root = flag.String("root", "/home/chinmay/work/ajax/", "Set root directory, use absolute path") 
func temp(w http.ResponseWriter, r *http.Request){ 
        http.ServeFile(w,r,*root +"ajax.html") 
} 

func main(){ 
        http.HandleFunc("/", temp) 
        http.Handle("/static/", http.FileServer(*root, "/static/")) 
        http.ListenAndServe(":8888", nil) 
} 

ajax.html contains the following:

<html> 
    <head> 
        <script type="text/javascript" src="/static/jquery.js"></script> 
        <script type="text/javascript" src="/static/three/Three.js"></script> 
        <script type="text/javascript" src="/static/js/Detector.js"></script> 
        <script type="text/javascript" src="/static/js/RequestAnimationFrame.js"></script> 
        <script type="text/javascript" src="/static/js/Stats.js"></script> 
        <script type="text/javascript"> 
            $.ajaxSetup ({ 
                cache:false; 
            }) 

            $("#container").ready(function(){ 
                $("button").click(function(){ 
                    $.getScript("model.js"); 
                }); 
            }); 
        </script> 
    </head> 
    <body> 
        <button>Use Ajax to get and then run a JavaScript</button> 
        <div id="container"> 
        </div> 
    </body> 
</html> 

socket.js : http://www.grideads.net/redmine/attachments/download/113/socket.js
model.js : http://www.grideads.net/redmine/attachments/download/112/model.js

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:29:25+00:00Added an answer on May 23, 2026 at 5:29 pm

    I did not decode the question, but a possible issue is the way you call your script

    $.getScript("model.js") 
    

    http://localhost:8888/ will call http://localhost:8888/model.js

    http://localhost:8888/static/ajax.html will call http://localhost:8888/static/model.js

    EDIT
    also your model.js has an error on line 133

    for( j = 0, jl = meshes.length; j < jl; j++ )
    

    the proper for loop format is

    for (variable=startvalue;variable<=endvalue;variable=variable+increment)
    

    j < jl; is extra, resulting in the “Unexpected token <” error message

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a subversion server with access via http using webdav. I have
We have a job management application running (Access) with the database in SQL Server
Currently running Server 2003 but am looking at reinstalling in the near future due
Iam running WAMP server and just enabled php_memcache extension and have tried the code
after running python manage.py syncdb i gett an error saying unable to open database
I'm running Django on Ubuntu Server 9.04. Django works well, but nginx doesn't return
I just started experiment with EC2 tonight, and got a server running locally. I
I have a tomcat (7) server running, through which I try to access some
so, I'm running Apache on my laptop. If I go to localhost, I get
Using the Windows HTTP API I'm running a HTTP file server on localhost. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.