#6639 closed enhancement (worksforme)
ui.autocomplete does not encode params prior to getJSON call
Reported by: | paul.morgan | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.autocomplete | Version: | 1.8.6 |
Keywords: | autocomplete encode encodeURIComponent getJSON XHR | Cc: | |
Blocked by: | Blocking: |
Description
The Autocomplete plugin does not encode user input "out of the box" when using a remote data source - it just pipes it straight into a getJSON call.
As you can imagine, depending on the data sent, you may or may not get away with this.
This can be sorted out by including:
var prop; for(prop in request) { request[prop] = encodeURIComponent(request[prop]); }
...prior to the getJSON() call on line 248.
Please find attached a copy of the unminified autocomplete source with this added.
Note the new lines of code on 237, 249-251.
Attachments (1)
Change History (3)
Changed 13 years ago by
Attachment: | jquery.ui.autocomplete_withEncodeURIComponent.js added |
---|
comment:1 Changed 13 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
$.getJSON delegates to $.get, which delegates to $.ajax, which uses $.param to serialize the data, which eventually uses encodeURIComponent.
If there's some way to send data without hitting encodeURIComponent, please provide a testcase.
Version of ui.autocomplete 1.8.6 which uses encodeURIComponent() when using a remote data source