function CallMethod() {
$.getJSON('/website/RESTfulService.svc/LiveLocation/json?{x=1,y=2}', function(data) {
getResult(data.lat, data.lon);
});
}
-
try '/website/RESTfulService.svc/LiveLocation/json?x=1&y=2'Nicocube– Nicocube2012-03-05 16:55:14 +00:00Commented Mar 5, 2012 at 16:55
Add a comment
|
3 Answers
Pass them as an object just after the URL and before the function:
function CallMethod() {
$.getJSON('/website/RESTfulService.svc/LiveLocation/json',
{
x: "1",
y: "2"
},
function(data) {
getResult(data.lat, data.lon);
});
}
2 Comments
Martin Meeser
I had no idea this is possible, just great.
Dylan Czenski
How about passing no parameter/void? should I do
$.getJSON('/website/RESTfulService.svc/LiveLocation/json',null,function(data){...});?Alternatively, first create javascript object for the sake of simplicity and then pass
var myObject = {x: "1", y: "2"};
$.getJSON('/website/RESTfulService.svc/LiveLocation/json', myObject, function(dataVal) {
//Use Your result
});
3 Comments
Holger Ludvigsen
This is basically the same answer as Zheileman's, and it is not easy to read.
Rahul Srivastava
I know this is the same answer but the way of passing your data as a parameter is different. I have already mentioned that It is for the sake of simplicity.
Holger Ludvigsen
I see your point. I have submitted a suggested edit of your answer which is more readable (which is the purpose of this alternative solution)