Page 1 of 1

How can I run a query service in Javascript?

Posted: Sun Mar 02, 2014 3:54 pm
by GodSpeed JP1

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!!!".


How can I run a query service in Javascript?

Posted: Sun Mar 02, 2014 4:06 pm
by Alena Prykhodko

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...


How can I run a query service in Javascript?

Posted: Sun Mar 02, 2014 4:32 pm
by GodSpeed JP1

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


How can I run a query service in Javascript?

Posted: Sun Mar 02, 2014 5:00 pm
by Alena Prykhodko

How can I run a query service in Javascript?

Posted: Mon Mar 03, 2014 3:04 am
by GodSpeed JP1

Thank you Alena.
It works.