Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2009, 02:31 AM   PM User | #1
gBerger
New to the CF scene

 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
gBerger is an unknown quantity at this point
JSON Web Service in asp.NET, vb.Net

The web service successfully gets called if data: {} (no parameters) are passed.

But if I try to pass a parameter, an error occurs.
The Code Behind doesn't seem to like the parameter passing.

What am I doing wrong when passing the parameter?
I have tried:
//"{'fname':'dave'}" << doesnt work
//"{fname:dave}" << doesnt work
and actually a few others that I am too embarrassed to print.


$.ajax({
type: "POST",
url: "wsLkup2_Load.asmx/Lkup2_Load",
data: {fname:dave}, << Error with ANY parameter. Works if just {} (no parameters)
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(result) {
alert(result.d);
},
error: function(req, status, error) {
alert('asdfasdf ERROR');
}
});

CODE BEHIND
===========

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class wsLkup2_Load
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function Lkup2_Load(ByVal p_s_UsrID As String) As String
' if the parameter is removed, the web service is successfully called.
Return "Hello World"
End Function

End Class
gBerger is offline   Reply With Quote
Reply

Bookmarks

Tags
json, vb.net, web service

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:02 PM.


Advertisement
Log in to turn off these ads.