title: reading json data from a file
body: <p>I am running a server with Go programming language, and when I load the server in the browser, the temp handler function is called and the getjson.html file is served by this temp Handler function. Now the screen shows a "Get Json Data" button. On clicking this button, I am not getting any results (as something should be displayed on the screen).</p>
  
  <p>I checked the javascript console and there are no errors as such. 
  I am not able to figure out what the problem is, why isn't there any output on the screen.</p>
  
  <p>Contents of servejson.go : </p>
  
  <pre><code>package main
  
  import (
      "http"
      "flag"
  )
  
  var path = flag.String("root", "/home/chinmay/work/json/getjson.html", "Set root directory, use absolute path")
  
  func temp(w http.ResponseWriter, r *http.Request){
      w.Header().Set("Content-Type", "text/html")
      http.ServeFile(w,r,*path)
  }
  
  func main(){
      http.HandleFunc("/",temp)
      http.ListenAndServe(":8080", nil)
  }
  </code></pre>
  
  <p>Contents of getjson.html : </p>
  
  <pre><code>package main
  
  import (
      "http"
      "flag"
  )
  
  var path = flag.String("root", "/home/chinmay/work/json/getjson.html", "Set root directory, use absolute path")
  
  func temp(w http.ResponseWriter, r *http.Request){
      w.Header().Set("Content-Type", "text/html")
      http.ServeFile(w,r,*path)
  }
  
  func main(){
      http.HandleFunc("/",temp)
      http.ListenAndServe(":8080", nil)
  }
  </code></pre>
  
  <p>Contents of json_data.js:</p>
  
  <pre><code>{ 
    "firstName": "John",
    "lastName": "Doe",
    "age": 25
  }
  </code></pre>