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

  • SEARCH
  • Home
  • 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 3394728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:12:17+00:00 2026-05-18T04:12:17+00:00

I am developing a web app that accesses some external JSON data. I’m currently

  • 0

I am developing a web app that accesses some external JSON data. I’m currently using jQuery’s getJSON to get the data and call the callback.

My internet at home is terrible, so I’m regularly not connected. I am looking for a way to develop this app while disconnected from the internet.

My initial thought was to have an OFFLINE variable that I set, which changes the location of the scripts to a local file, but because jQuery’s getJSON uses dynamically named functions for callbacks, it would need some server intelligence.

More info on how getJSON callbacks work here: http://docs.jquery.com/Ajax/jQuery.getJSON

I’m sure there’s an easier way. Any suggestions?

** Edit **

Let me try and clarify a bit
I’m currently running a local web server. I have to – script tags can’t reference a local file, for security reasons.

I’m currently calling getJSON with the url: http://twitter.com/status/user_timeline/user.json?callback=?

If I downloaded that json response and hosted it on the local webserver, it wouldn’t work, because the callback name will change every time, yet the feed will have the function name it was originally fetched with.

  • 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-18T04:12:18+00:00Added an answer on May 18, 2026 at 4:12 am

    I used a local sinatra webserver, and replaced the hosts in my /etc/hosts file. It’s nice because it’s super easy to define new services.

    I often forget to reset my hosts file, which can cause a lot of frustration, so I created a script to wrap the whole thing as well.

    Here’s an example that will serve up a twitter user feed.

    run.sh

    #!/bin/bash
    cp /etc/hosts /etc/hosts.original
    cat offline_hosts >> /etc/hosts
    ruby server.rb -p 80
    cp /etc/hosts.original /etc/hosts
    

    offline_hosts

    127.0.0.1   twitter.com
    

    server.rb

    #!/usr/bin/ruby
    require 'sinatra'
    
    # twitter user
    # http://twitter.com/status/user_timeline/$USER.json&callback=?
    get '/status/user_timeline/:username.json', :host_name => /twitter\.com/ do
      render_file "feeds/#{params[:username]}.json"
    end
    
    def render_file filename
      output = File.open(filename).read
      output = "#{params[:callback]}(#{output});" if params[:callback]
      output
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing web app that user can save his/her work to server. The data
I am developing a web app (using rails) that I will be launching within
I'm developing a web app that needs to do some backend processing while still
I'm developing a Web App that uses JavaScript + JQuery on the client side
I'm developing a web app that needs some sort of filesystem access. Ideally I'd
I'm currently developing a moderately large sized web app with ASP.NET 2.0 that uses
I am currently developing a web app that uses Google's Static Map API, in
I am developing a free mobile app that accesses a Web Service and downloads
I am developing a web app that sends out emails. Currently, all emails have
I am developing a web service that will be invoked (using JSON) from client

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.