ajax - Creating REST parameters for jQuery consume webservice -


I am using jQuery to consume a web service that I created, the input was currently serialized in JSON , As well as jQuery output AJAX.

I would like to make the service more confusing by adding URI query string parameters so that users can access the same page of search results, query string, etc. URI as their state

I do not believe there is a need to change a lot in my web service. Should I use and rewrite the URI using jQuery? If so, then does anyone have any such post that shows how?

Thanks

Web service:

  /// & lt; Summary & gt; Summary Details for /// WebServices & lt; / Summary & gt; [WebServices (Namespace = "http://tempuri.org/")] [Websisibing (conferenfo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem (false)] // Allow this web service to call scripts For example, by using ASP.NET AJAX, delete the following line [System.Web.Script.Services.ScriptService] Public class WebService: System.Web.Services.WebService {[WebMethod] [ScriptMethod (ResponseFormat = ResponseFormat.Json) )) Public OutputData Update ProductsList (inputdata request) {//...// Return Results; }  

and Ajax request is using JSON serialization:

  // ajax request var request = {request: {qtype: "ProductName", Query: query text, page: result page, rp: rp}}; $ .exax ({type: "post", url: "/webservice/WebService.asmx/updateProductsList", data: JSON.stringify (req), content type: "app / jason; charset = utf-8", datatype: "Json", success: function (msg) {   

I do not know about it Web service, but in the favor of jQuery, if your parameters are qtype , query , page and RP Just change:

  data: JSON.stringify (req)  

to

  data: req.request  

or Only

  var request: {qtype: "ProductName", query: query text, page: result page, rp: rp}}; // and data: request  

Of course you have to change your web service to accept those GET parameters.

I hope that your question is correct.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -