Ajax with friendly urls

infis

Well-known member
Why
Code:
http://server.com/members/find&_xfResponseType=json
return 404 error, but
Code:
http://server.com/index.php?members/find&_xfResponseType=json
return correct response?
 
Hm. Thanks!
Class "Autocomplete" add path as index.php?members/find&_xfResponseType=json. And on forums with enabled friendly urls it's path is some. That is not true or correct?
 
The index.php version of URLs remains working, even with friendly URLs enabled:

http://xenforo.com/community/index.php?threads/ajax-with-friendly-urls.75474/#post-774793

And when the unfriendly URL is hidden away in some AJAX request somewhere, the friendly URL is pretty irrelevant. The default AutoComplete URL is an unfriendly URL because it's hard coded in the javascript, and its done that way because the javascript has no access to a link building class or any concept of the XenForo options to determine if the friendly URLs are working or not.

You can pass any URL you like, friendly or unfriendly to the JS as a data-acurl attribute assigned on the input element.
 
I know that I can set any URL. I was interested in only the extent properly when the friendly URL for use AJAX links with index.php. It turns out that this is not a bug, but a feature. Well so be it. Although I do not seem right.
 
Of course it is right.

How is it wrong?

It's a hard coded URL in the JS code to ensure full compatibility regardless of URL configuration.

I don't see how else it could be done.
 
Ok. Of course, we can pass a variable to the script base URL. But we can use and not user-friendly URL.
Thanks for the help!
 
Top Bottom