Invoke server side method using XMLHttpRequest?

I believe you are probably referring to ASP. NET Page Methods when you say One static webmethod in my aspx file ASP. NET page methods (or web services for consumption in JS) uses JSON serialization for i/p and o/p.So you need to set JSON as the content type for the request and actually send the JSON string in the body i.

E var sendStr = "{name:" + inputValue + "}"; ... request. SetRequestHeader("Content-Type", "application/json"); ... request. Send(sendStr) Further, I will suggest you to use jquery or ASP.

NET generated proxies (by ScriptManager) instead of directly coding against XmlHttpRequest. See this article for how to use jquery for calling Page methods.

I believe you are probably referring to ASP. NET Page Methods when you say One static webmethod in my aspx file. ASP.NET page methods (or web services for consumption in JS) uses JSON serialization for i/p and o/p.

So you need to set JSON as the content type for the request and actually send the JSON string in the body i.e. ... var sendStr = "{name:" + inputValue + "}"; ... request. SetRequestHeader("Content-Type", "application/json"); ... request.

Send(sendStr); Further, I will suggest you to use jquery or ASP. NET generated proxies (by ScriptManager) instead of directly coding against XmlHttpRequest. See this article for how to use jquery for calling Page methods.

Can you plzz give me full code. You just change the 3 line only. – Thomas Sep 2 at 9:53 @Thomas, IMO, first two lines are only ones that needs change - the rest of code that you quoted should remain as is.

For troubleshooting, you should use tool such as fiddler (or Firebug on Firefox) to inspect HTTP request and response. – VinayC Sep 2 at 10:01 what is the meaning of request. SetRequestHeader("IsLookup", "true"); what is IsLookup....what is the importance.

– Thomas Sep 5 at 13:04 @Thomas, AFAIK, it's not a standard HTTP header and it does not have any meaning ASP. NET Ajax as well as. I was assuming that its some custom header that you are setting to do some processing in server side code (probably HttpModule).

– VinayC Sep 7 at 4:12.

I think, the easiest way will be usage of jQuery for ajax requests: api.jquery.com/category/ajax.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions