开发者

How to send and receive data using ASP.NET Web Service and JQuery?

开发者 https://www.devze.com 2022-12-31 04:44 出处:网络
I want to run a web service method with parameters and get method return value back using JQuery. ie.

I want to run a web service method with parameters and get method return value back using JQuery.

ie.

client :

var result = dosomething(var p1, var p2, var p3 ....);
开发者_开发百科

when do something accesses WebService with

dosomewebservice(int p1,int p2, string p3) { return "something" };
result == "something";


You can access with jQuery a web service marked with attribute [ScriptService].

Example


First of all, does your web service call need to be asynchronous? And do you want to return XML or JSON.

If you're returning a string, use JSON - much faster over the wire. Even though your serializing/deserializing (which causes overhead), the overhead on the server/client is better than the overhead over the wire.

Calling a JSON-web service using jQuery - look at $.getJSON.

0

精彩评论

暂无评论...
验证码 换一张
取 消