I am using jQuery to consume a web service I built, the input is currently serialized JSON, as well as the output via jQuery AJAX.
I'd like to make the service more RESTful by adding URI query string parameters so that users can access the same same page of search results, query string, etc. etc., when they save the URI as their state.
I don't believe my web service needs much changing. Should I access and re-write the URI using jQuery? If so does anyone have any posts that demonstrate how to do this?
Thanks
Web service:
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public OutputData updateProductsList(InputData request)
{
//...//
return result;
}
And the Ajax request using JSON Serialization:
//Build the ajax Request
var req = { request: { qtype: "ProductName", query: queryText, page: resultPage, rp: rP} };
$.ajax({
type: "POST",
url: "/webservice/WebService.asmx/updateProductsList",
data: JSON.stringify(req),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {