Pankaj Sharma
Pankaj Sharma

Reputation: 2277

Can't understand from where this script is making ajax call (no $.ajax)

I am a using ajax_select app for autocomplete, it is having its predefined JavaScript file for autocomplete, working fine for me, but I also want to add some extra paras in ajax call, now it is calling to url -

/ajax_select/ajax_lookup/sizes?term=lar

but what I want is:

/ajax_select/ajax_lookup/sizes?term=lar&filter=shoe

I tried many attempts but unable to add extra para because I am unable to understand how it is making ajax call and how it is passing parameters ?

There is no $.ajax function ! how it is going to possible ?

This is full code of that js file:

https://github.com/crucialfelix/django-ajax-selects/blob/develop/ajax_select/static/ajax_select/js/ajax_select.js

I have read the documentation, there is noting related to it because it is a django app, there is not much info about its JavaScript file.

I am not much familiar with JavaScript, anyone how can help me ?

Upvotes: 0

Views: 109

Answers (1)

Mehmet
Mehmet

Reputation: 1874

I've no idea about django. If I didnt misunderstand; you are trying to add extra paramter to ajax request. I looked up github repo of "django-ajax-selects" which you use. The author says it depends on "jQuery UI AutoComplete" at repo's readme file. So you should search about "jQuery UI AutoComplete". You can add extra paramters to "jQuery UI AutoComplete" Please look here ; How do I pass an extra parameter to Jquery Autocomplete field? You should use jQuery UI AutoComplete's source method. Look at django-ajax-selects docs here for using source method: http://django-ajax-selects.readthedocs.io/en/latest/jQuery-plugin-options.html

Upvotes: 1

Related Questions