Dan
asked on
Can't get return value from VB.NET method in Jquery using $.ajax
I'm a noob at jquery and ajax. Bascially I have a vb.net class file that is calling some webservices. I need to return the parsed values of the webservice calls back to the original page. When I try it according to posted examples the return value is always null. As a test I changed the vb.net file to return a hardcoded value and still nothing. Does my vb file have to be a webservice? I've seen several examples that are. Below is my code:
VB.NET CODE
-------------------------
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Xml
Imports System.Xml.XPath
imports System.Web.Services
Partial Class getInfo
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
getInfo(Request.Form(0))
End Sub
public function getInfo(ByVal Postal As String) as string
return "hi"
end function
protected sub dosomethingelse()
end sub
End Class
JQUERY CODE
-------------------------
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script language="javascript">
$j = jQuery.noConflict();
function Postal()
{
if (document.getElementById('txtPostal').value == '')
{
alert('Please enter a valid postal code');
}
else
{
$j.post("http://devsite/GetInfo.aspx", {postal: document.getElementById('txtPostal').value}, function(data){alert(data);});
}
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER