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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:49:06+00:00 2026-05-23T19:49:06+00:00

I’m trying to transfer Rails-generated json into Google Maps markers on a map, but

  • 0

I’m trying to transfer Rails-generated json into Google Maps markers on a map, but first I’m just trying to display that json, because I’m new to jQuery/JavaScript and trying to understand it.

However, I’ve been stuck with a Chrome developer console error message I do not understand:

Uncaught TypeError: Object function $(element) { 
if (arguments.length > 1) { 
  for (var i = 0, elements = [], length = arguments.length; i < length; i++) 
  elements.push($(arguments[i])); return elements; 
} 
if (Object.isString(element)) element = document.getElementById(element); 
  return Element.extend(element); 
} has no method 'ajax'

I tried using code from various tutorials / examples but got none of them working. My code looks currently like this:

$.ajax({
    url: "http://localhost:3000/spots.json",
    success: function(html){
        $("#json").append(html);
    }
});

So this is taken from an example, and the idea was just to show what the json request returns. There must be some fundamental error in my thinking / code, because I just can’t get it working.

So my question is: how should I read that error and then how to make this code fetch the json from spots.json and show it in the #json-div in my html?

Thank you!

** APPENDIX **

Here’s the whole spots.js file:

$(document).ready(function() {

var latlng = new google.maps.LatLng(60.17, 24.93);

var myOptions = {
  zoom: 12,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
};

var map = new google.maps.Map(document.getElementById("map_canvas"),
    myOptions);

$.ajax({
    url: "http://localhost:3000/spots.json",
    success: function(html){
        $("#json").append(html);
    }
});
});

The spots.json looks like this:

[{"spot":{"address":"","category":"Ramppi","created_at":"2011-07-13T14:06:44Z","latitude":60.171916,"title":"Kiasman \"Design-ramppi\"","updated_at":"2011-07-13T14:06:44Z","id":1,"area":"Helsinki","description":"","longitude":24.935875}},{"spot":{"address":"","category":"Puuli","created_at":"2011-07-13T14:07:07Z","latitude":60.176526,"title":"Tattipuuli","updated_at":"2011-07-13T14:07:07Z","id":2,"area":"Helsinki","description":"","longitude":24.919395}}]
  • 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-23T19:49:07+00:00Added an answer on May 23, 2026 at 7:49 pm

    Looking at the definition of $ in your code, it seems like you’re using the Prototype framework as well. A problem when using multiple libraries is that they are overwriting variables, mainly the $.

    In your case, use jQuery instead of $ (so jQuery.ajax(...)), or use jQuery.noConflict to restore the $ back to the jQuery one.

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

Sidebar

Related Questions

No related questions found

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.