I need to use this code over and over in my page, how can I create a function or a class to pass it the values and have it return the json response?
Here is the code I have:
var values = HttpUtility.ParseQueryString(string.Empty);
values["q"] = Request.Form["query"];
values["l"] = Request.Form["location"];
UriBuilder builder = new UriBuilder("http://api.url.com/");
builder.Query = values.ToString();
var url = builder.ToString();
var client = new WebClient();
var json = client.DownloadString(url);
var search = Json.Decode(json);
Go to the complete details ...