GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

How can I run a query service in Javascript?

Hi,
I have a REST query servcie named "getUser".
I run it in a javascirpt.like below, I want to get the data where usreID=2,
but the "where" is ignored.It always return a full list of User.
Can anyone help me?
///////////////////////////////////////////
getUser.execute({
where:{userID:"2"},
success:function(data){
alert("success!!!"+data.length);
},
error:function ( jqXHR, textStatus, errorThrown ) {
alert("error!!!");
}
});
///////////////////////////////////////////
this return a full list.
I also try:
///////////////////////////////////////////
getUser.execute({data:{
where:{userID:"2"}},
success:function(data){
alert("success!!!"+data.length);
},
error:function ( jqXHR, textStatus, errorThrown ) {
alert("error!!!");
}
});
///////////////////////////////////////////
This return a "error!!!".

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How can I run a query service in Javascript?

Hi,

Please try to replace with:
pre
getUser.execute({
where:{"userID":2},
success:function(data){
alert("success!!!"+data.length);
},
error:function ( jqXHR, textStatus, errorThrown ) {
alert("error!!!");
}
}); /pre

Please learn more about queries syntax http://docs.appery.io/documentation/b...

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

How can I run a query service in Javascript?

Thank you Alena.
But it still returned a full list.
I also tried
where:{"userID":"2"},
Nothing changed.
Any other ideas?

GodSpeed JP1
Posts: 0
Joined: Thu Feb 27, 2014 1:23 pm

How can I run a query service in Javascript?

Thank you Alena.
It works.

Return to “Issues”