olafgleba Posted April 21 Share Posted April 21 (edited) Hi, i only found posts with Ajax + Search topics, which does not help me with my question i am afraid. Within a form i narrow down the results to specific conditions (here: countries assigned to continents). While the first select (continents, s. Screen 1) is populated on page load, the second one gets filled up by a ajax call/response (form action attribute references to that ajax driven page). Works well. What i cannot figure out is why the ajax driven page does not consider the current language when quering pages ($pages->find()) within the ajax page (s. screen 2 (country names should be in english, not in german). As the ajax driven page is a regular PW template based page, i would expect that PW detects the language versions of the page fields automatically like on any other page. Without specifying something additionally. But obviously not. And i miss something or doing it wrong. Maybe helpful: The ajax page is a processwire page derived from a dedicated template. ProcessWire namespace is set (on the ajax driven page) All language checkboxes (Tab settings) in related pages are active Default language is german, both screens showing the page set to english. Thx in advance for any hint. cheers Olaf Screen 1: Screen 2: Edited April 21 by olafgleba Link to comment Share on other sites More sharing options...
bernhard Posted April 21 Share Posted April 21 If I'm not missing something it should be easy: The ajax request will return data in the language that the request was sent to. A request to example.com/whatever would return english A request to example.com/de/was-auch-immer would return german You just have to make sure to send the request to the correct endpoint. 1 Link to comment Share on other sites More sharing options...
olafgleba Posted April 21 Author Share Posted April 21 Moin @bernhard, so good! :-). The last sentence got me going. I overlooked to adjust the js ajax endpoint url on language switch. Next beer on me, please 😉 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now