Reputation: 2943
When calling JsonRest using dojo, how can I pass parameters with it.
var rest = new JsonRest({
target: "/path/to/service"
});
Upvotes: 0
Views: 1123
Reputation: 73918
JsonRest example:
require(["dojo/store/JsonRest"], function(JsonRest){
// create a store with target your service
var store = new JsonRest({
target: "/path/to/service"
});
// make a get request passing some options
store.query("foo=bar", {
start: 5,
count: 5,
sort: [
{ attribute: "color", descending: true }
]
}).then(function(results){
// result here
});
});
The function to use in your case is query
with signature query(query, options)
When called, query
will trigger a GET request to {target}?{query}
, as described in dojo docs.
Please keep in mind that:
Your service/API should:
Upvotes: 1