Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for jsonp remote requests #13

Closed
wants to merge 2 commits into from
Closed

Add support for jsonp remote requests #13

wants to merge 2 commits into from

Conversation

sullimander
Copy link

Added support for setting the dataType for the transport.get request. Only supports json and jsonp. Defaults to json.

@@ -131,6 +131,7 @@ The transport component is a singleton used by all typeaheads initialized with t

* `maxConcurrentRequests` - The max number of AJAX requests typeahead.js can have pending. Defaults to `6`.

* `dataType` - The jQuer ajax dataType option to use. Can be either `json` or `jsonp`. Defaults to `json`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jQuery*

@jharding
Copy link
Contributor

Based on some of the feedback we've gotten so far, I think I may have to rewrite the transport component to make it a bit more flexible. I'll be sure to include this change in the rewrite.

@sullimander
Copy link
Author

Sounds good, I look forward to seeing the update.

@jharding jharding mentioned this pull request Feb 22, 2013
@dogoku
Copy link

dogoku commented Feb 22, 2013

How about using automatic detection to decide between json and jsonp

_getDataType: function (url) {
    //all of that because IE doesnt support location.origin 
    var origin = RegExp([ location.protocol, "//", location.host, location.port].join(""));
    return origin.test(url) ? "json" : "jsonp";
},

Or something along those lines.

@jharding
Copy link
Contributor

Closing in favor of #25.

@jharding jharding closed this Feb 23, 2013
jlbooker added a commit to jlbooker/typeahead.js that referenced this pull request Nov 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants