Jump to content

Recommended Posts

Posted

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!

  • 2 weeks later...
Posted

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"
 
Posted

@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?

Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...