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

{{query}} on url does not get updated on the second search #87

Closed
bichotll opened this Issue Oct 10, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@bichotll

bichotll commented Oct 10, 2015

I found out that {{query}} in url parameter does not change every time query changes.
I've tested it and it does with data but not on the url. It just goes once to url:

https://github.com/running-coder/jquery-typeahead/blob/master/src/jquery.typeahead.js#L647

Documentation:

url: [{
            type: "POST",
            // The {{query}} can also be replaced inside the URL
            // url: "/jquerytypeahead/{{query}}",
            url: "/jquerytypeahead/user_v1.json",
            data: {
                q: "{{query}}",
                type: function () { return $('#user-type').val(); }
            }
        }, "data.user"]

I've tried to debug it and then solve...but the code does not look familiar for me.
Let me know.

@running-coder

This comment has been minimized.

Owner

running-coder commented Oct 10, 2015

hey bichotll, can you paste your typeahead init code? the problem may be there.

@bichotll

This comment has been minimized.

bichotll commented Oct 10, 2015

I've even tried to apply the example one without luck ;)

  var $searchInput = $("#search-input");
  $searchInput.typeahead({
    minLength: 2,
    delay: 300,
    dynamic: true,
    source: {
      streets: {
        display: 'street_name',
        url: [{
          type: "GET",
          url: "/jquerytypeahead/{{query}}"
        }, 'streets']
      }
    }
  });
@running-coder

This comment has been minimized.

Owner

running-coder commented Oct 10, 2015

Cool, I'll have a look. Thought this got solved when doing #67

@bichotll

This comment has been minimized.

bichotll commented Oct 10, 2015

Nice! Cheers!

I've just created a workaround on my temporally branch:
https://github.com/bichotll/jquery-typeahead/blob/master/src/jquery.typeahead.js#L551

@running-coder running-coder added the Bug label Oct 10, 2015

@running-coder running-coder changed the title from Query on url does not work to {{query}} on url does not get updated on the second search Oct 10, 2015

@running-coder

This comment has been minimized.

Owner

running-coder commented Oct 10, 2015

Thanks for reporting the issue, should be fixed inside the master branch

running-coder added a commit that referenced this issue Oct 22, 2015

Version 2.1.3
Fixes #87 {{query}} on url does not get updated on the second search
Fixes #92 resultContainer wont dismiss on blur
Fixes #93 Sending xhr request are not cleared once completed
Fixes #94 onLayoutBuiltBefore & this.hintIndex ordering issue

Minor CSS compatibility issue w/ Bootstrap4
Replaced deprecated $Ajax.complete callback -> http://api.jquery.com/jquery.ajax/ for jQuery 3.0-alpha
Minor: Fixed CSS issue on dark background using hint option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment