1

I don't understand why this jQuery.AJAX-request to a .csv-file fails to display a Highchart chart in Rails:

var jQuery = $.get('foo.csv', function(data) {}

whereas this one displays just fine:

var jqxhr = $.get('foo.csv', function(data) {}

Can anybody please explain?

ljnissen
  • 139
  • 1
  • 12

2 Answers2

2

jQuery is the name of the main function in the jQuery library ($ is just a synonym for it). You shouldn't reuse it in your own code. Although if this is a local variable, I don't think it should affect the library, it uses the global variable window.jQuery. But it's still a bad idea to use this variable name, it will be confusing.

Barmar
  • 741,623
  • 53
  • 500
  • 612
1

The only difference here is the name of your variable – perhaps jQuery is just a reserved word?

msanteler
  • 2,163
  • 1
  • 16
  • 21