WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
Go Back  Xtreme Visual Basic Talk > > > WebService called by Javascript throws Undefined error


Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2011, 02:09 PM
DoughBoy DoughBoy is offline
Centurion
 
Join Date: Jun 2006
Posts: 196
Default WebService called by Javascript throws Undefined error


Hello Everyone,

I'm trying to upgrade a website from .NET 2.0 to 4.0 and I'm having some trouble with the sites' WebServices. A common solution I've found is that the WebService naming convention is incorrect. Sadly, this has not worked for me.

My current layout:
• Namespace: TrialSite
• Webservice class: TestService (file test.asmx)
• Webservice Function: Add

Javascript IntelliSense identifies "TestService.Add" but running the website causes javascript to throw an error - 'TestService' is Undefined. I have tried adding "TrialSite" to the beginning (resulting: TrialSite.TestService.Add) but then javascript throws an error - 'TrialSite' is Undefined.

Has anyone experienced this problem with .NET 4.0? What was your solution? I have tried creating a WCF service instead of asmx, but this too doesn't work (javascript throws the same errors). Can anyone offer some insight on how I can resolve this?

Thanks to all for their help.
Reply With Quote
  #2  
Old 06-01-2011, 12:28 PM
alexsts alexsts is offline
Freshman
 
Join Date: Apr 2010
Posts: 32
Default

I believe you encountered the cross-domain problem. different port number would be considered as a different site.
There are some means to make a cross domain call by js, here is a good article http://developer.yahoo.com/javascript/howto-proxy.html which may apply to your situation.
Take a look.
Reply With Quote
  #3  
Old 06-01-2011, 02:11 PM
PlausiblyDamp's Avatar
PlausiblyDampWebService called by Javascript throws Undefined error PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Did this work under .Net 2 before the upgrade?

It has been a while since I have done this but a couple of things that might help
  • Have you marked the service as being accessible from a script with the <System.Web.Script.Services.ScriptService()> attribute?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
 
WebService called by Javascript throws Undefined error
WebService called by Javascript throws Undefined error
 
-->