How to use jQuery to make a call to c# file to get return value

Posted by aspdotnetuser on Stack Overflow See other posts from Stack Overflow or by aspdotnetuser
Published on 2010-05-24T14:33:52Z Indexed on 2010/05/24 15:21 UTC
Read the original article Hit count: 198

Filed under:
|

Hi,

I want to use jQuery to make a call to a c# web service called CheckUserName.ashx which checks whether that username is valid and returns an error message as a string.

How can I use to jQuery to do this? Would the code be something like the following?

 jQuery.ajax({
 type: "GET",
 url: "/services/VerifyUsername.ashx",
 data: "ErrorMessage",

 success: function (msg) {
     alert("success");

 },
 error: function (msg, text) {
     alert(text);
 }
 });

});

Any help will be appreciated!

Thanks,

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery