hi everybody I'm using jquery ajax within a custom method and try to return its result to that original method but I get nothing while it works fine if I show it in alert window
here is my code: jQuery(document).ready(function() { jQuery.Test = function(){ jQuery.ajax({ type: "POST", url: "WebService.asmx/HelloWorld", success: function(msg) { // alert($("string", msg).text()); //it works fine return $("string", msg).text(); //it doesn't works }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(XMLHttpRequest.responseText); } }); }; alert(jQuery.Test());//it returns 'undefined' }); Thanks