I want to add a bit of AJAX magic to one of my pages. Just call a server-side method from JS, and get the result.
This turns out to be more difficult than expected.
First, I found out I can't have AJAX methods in a UserControl (http://stackoverflow.com/questions/5818265/pagemethods-is-not-defined
), as I work with UserControls (ascx) rather than Pages (aspx), since the result is supposed to be a widget added to the Sitefinity Toolbox.
From what I read, I have to create and use a web service to be able to achieve that (I'm not too happy about this, this is unneeded complexity, but oh well).
So, I followed the steps of this article: http://msdn.microsoft.com/en-us/magazine/cc163499.aspx
And now, after doing everything detailed in this article, I hit the following JS error as I call my AJAX method:
q is not a function
coming from line 3345 of Telerik.Sitefinity.Resources.Scripts.MicrosoftAjax.debug.js
This is my JS code:
, onComplete, onFailure);
My web service class:
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
Class : System.Web.Services.WebService
And I added this to my master page:
What am I doing wrong?
Is there a better way to do this?
By the way, why is this "debug" script file added even if I build in release mode? I'm thinking it's either poorly named and isn't actually a debug file, or it shouldn't be included.