verdeandrea Posted February 26, 2014 Share Posted February 26, 2014 Hi guys, i'm using the Page Web Service Module and i'm trying to do something like this: $.getJSON('/processwire/service-pages/?title,country,newspaper_country,newspaper,language,place,topics='+value, function(data) { console.log(data); }); where value is, let's say, "Brown". Now, i now for sure that there is a page white the title "James Brown" but this query gives no results. Could someone please help? Thanks! Link to comment Share on other sites More sharing options...
adrian Posted February 26, 2014 Share Posted February 26, 2014 Did you play with other operators other than "="? Brown != James Brown, so try ~= or %= depending on exactly how you want the matches to work. More info in the intro post: http://processwire.com/talk/topic/1654-module-pages-web-service-servicepages/ Link to comment Share on other sites More sharing options...
apeisa Posted February 26, 2014 Share Posted February 26, 2014 Also, why not try to get some results to browser screen before jQuery? Is url correct? 1 Link to comment Share on other sites More sharing options...
verdeandrea Posted March 13, 2014 Author Share Posted March 13, 2014 Sorry guys, i didn't see your answers. @adrian when i try this var search_url = root_path+'service-pages/?title,country,newspaper_country,newspaper,language,place,topics~='+value; $.getJSON(search_url, function(data) { ... }); i get this error in array "Field 'topics_' is not allowed in queries" like the tilde is converted to an underscore. Maybe some problem related to escaping the url (i've tried with no results...) @apeisa yes, i have the results array in the console log but it says 0 results. I really do not understand... EDIT: this is the selector i get in the returned object "title|country|newspaper_country|newspaper|language|place|topics=Reusher, template=giornalista, limit=50" is it correct? EDIT 2: if i try with '*=' operator i get "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='reusher' JOIN pages AS _fieldtypepage2 ON _fieldtypepage2.name*='reusher' JO' at line 3" Link to comment Share on other sites More sharing options...
adrian Posted March 13, 2014 Share Posted March 13, 2014 @verdeandrea - you can't use commas with this module. Take a look at the instructions page again: http://processwire.com/talk/topic/1654-module-pages-web-service-servicepages/ Note that unlike regular ProcessWire selectors, multiple field=value sets are split with an ampersand "&" rather than a comma ",". Link to comment Share on other sites More sharing options...
verdeandrea Posted March 16, 2014 Author Share Posted March 16, 2014 @adrian I'm using comma in this way 'service-pages/?title,country,newspaper_country,newspaper,language,place,topics='+value In the instruction page Ryan says Specify multiple fields where at least one must match the value. Note use of "," rather than "|", something we had to settle for to make it work as a URL key:?field1,field2,field3=value Am I doing it wrong? Link to comment Share on other sites More sharing options...
adrian Posted March 17, 2014 Share Posted March 17, 2014 You can use commas like that. Sorry, I was looking at the returned selector and was thinking you were using that in the url. I would still do as apiesa says and just load the url initially in your address bar directly and see if you are still get the tilde/underscore issue. Have you tried the returned selector in a normal template file, or in Nik's Selector test module to make sure you are actually getting the results you expect? Link to comment Share on other sites More sharing options...
apeisa Posted March 17, 2014 Share Posted March 17, 2014 Also have you configured the module to return the actual template / fields? 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