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 9012235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:56:43+00:00 2026-06-16T02:56:43+00:00

My code is this: $.getJSON(/somefolder/somefile.json?+urlParams, function(json) { //populate combo here }); I’m working on

  • 0

My code is this:

$.getJSON("/somefolder/somefile.json?"+urlParams, function(json) {
    //populate combo here
});

I’m working on Rails, using sass and the file I have this code in is originally a file.js although to work with pipeline assets I already changed it to file.js.erb

In Dev I’m working in http://localhost:XXXX so results are OK.
In Prod I’m using a folder http://domain.com:XXXX/app so the results goes badways.

Coding like <%=image_tag("loading.gif", :class => "loading")%> works perfectly in this file but $.getJSON("<%= controller_method_path %>.json?"+urlParams does not

Any suggestion?

  • 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-06-16T02:56:45+00:00Added an answer on June 16, 2026 at 2:56 am

    Assuming your routes are setup to use a prefix in production, you should be using the actual routing methods for the full path.

    $.getJSON("<%= thingies_url(@thingy, :json) %>?"+urlParams, ...
    

    Now the entire path should be generated properly in all cases.


    But craziness like this is why it’s usually not recommend to run rails apps in a subdirectory of a domain. It makes routing and relative links to other pages and assets much more of a headache.

    If you can host the rails app on a subdomain instead.

    # not awesome :(
    http://mydomain.com/myapp
    
    # totally awesome! :D
    http://myapp.mydomain.com/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When using this code: <script> $(document).ready(function () { $.getJSON(http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?, function(data) { if(data[0].text.length > 107)
I'm using this code: <script> $(document).ready(function () { $.getJSON(http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?, function(data) { $(.show_tweet).html(data[0].text); }); });
I am using this code: $.getJSON(url, function(data) { console.log(data); }, json); Now, nothing gets
I'm trying to call this api http://www.wikirandom.org/json Using this code - $.getJSON('http://www.wikirandom.org/json', function(data) {
$.getJSON( test.php, function(data){ ... code should be here? } ) data contains this code:
I have this code which reads the JSON data: $.getJSON(data.json, function(data){ var output =
i have this code: $.getJSON('newMessageDetails', function (json) { var old_id = document.getElementById(td_id).value; var messages_count
Using this code $.getJSON(http://mydomain.com/getcustomers?callback=?,function(data) { .... }).error(function(err){ .... }) I'm getting jQuery16103492487950357067_1336742910384 was not
I have this code: $.getJSON('http://www.reapp.se/cmesapp/cmes.json?callback=?', function(data){ alert(disco); }).error(function() {alert(fail!;}); Which is sending out an
I have this code: $.getJSON(Featured/getEvents, function(data){ $.each(data.events, function(i,event){ var title = event.title.substr(0,20); $(#title-+i).text(Text); if

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.