2

I'm trying to query the Geonames data with select2 and everything appears to be working with formatting the results. However, an error is generated when the results are populated and I believe it is stopping the formatSelection function from not being executed.

The fiddle is here: http://jsfiddle.net/6CVbw/

The error being generated is:

Uncaught TypeError: Property 'jQuery18206926385117694736_1350159499559' of object [object Window] is not a function

Anyone have any ideas?

Edit: This happens in Chrome and Safari, try searching for London or Toronto.

d_ethier
  • 3,873
  • 24
  • 31

1 Answers1

3

This problem is inside select2 plugin. If be more accurate - in JSONP loading based on jQuery. As I see in your unpacked code here: http://jsfiddle.net/6CVbw/1/

You can comment this line:

//null !== d && d.abort();

And the problem is gone. It's caused by aborting JSONP requests. You can't abort JSONP calls - because you can't abort loading of script tags (JSONP technique).

More details covered here: Aborting jQuery JSONP request will throw error

You can make proxy script on your backend and request simple JSON, then .abort() should work correctly.

Community
  • 1
  • 1
Inferpse
  • 4,135
  • 1
  • 31
  • 39
  • Thanks! It does fix the Uncaught TypeError, but still will not select a result correctly. That's a different issue though. – d_ethier Oct 13 '12 at 21:28
  • That explains why I only seemed to see it depending on how fast I was typing, interesting. – ultranaut Oct 13 '12 at 21:39