• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Javascript: Extra params for Autocomplete field

sonnb

Well-known member
#1
Currently XenForo use this to pass extra params from data attribute to POST data.

Code:
if ($input.data('acOptions'))
            {
                options = $.extend(options, $.parseJSON($input.data('acOptions')));
            }
But since this example
Code:
data-acoptions="{"extraParams":1}"
would be automatically parsed as Object when calling: $input.data('acOptions'). It would not able to pass any params as parseJSON returns null.

It should be (without parseJSON).
Code:
if ($input.data('acOptions'))
            {
                options = $.extend(options, $input.data('acOptions'));
            }