Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Jquery Ajax Call

Vote:
 

Hi ,

 

Am working on a new project and trying to implement the Jquery ajax call. Here the problem is i have implemented the pagetype and created the page using it. and in my template page i have created the  WEB METHOD for my ajax call

in my template file wich is default.aspx , ihave method

 [WebMethod]
        public static string Add()
        {
            return "2";
        }

 

and am trying to access this methid using Jquery ajax method as

 

 $.ajax({
        type: "POST",
        url: "/Prototype/template/page/default.aspx/Add",
        data: "{}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            alert(msg.d);
        }
    });

But am not abel to get the values from this methos . What am i doing wrong ..?

 

#54432
Oct 14, 2011 13:59
Vote:
 

This isn't really anything to do with EPiServer CMS. I recommend you post this question on StackOverflow or some other more generic forum

#54435
Oct 14, 2011 15:18
Vote:
 

This is really a very generic question and not particulary related to EPiServer, but what you can do is to add following Http module:

 

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

  

To <system.web> or <system.webServer> element (depending on pipeline mode - classic or integrated).

This is a common pitfall when creating new project and 1st thing to try out is Ajax support for Asp.Net application.

#54708
Oct 29, 2011 17:05
Vote:
 

Hello,

Was this problem solve? I have the same issue here. I have a "POST" ajax call from my Template page and it return with Status Code: 404! I can't find wrong to my code, my WebMethod is there.

And I have already the line below to my web.config file.

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

Please help me.

#60497
Edited, Aug 13, 2012 11:38
Vote:
 

Add the Attribute

[System.Web.Script.Services.ScriptService] to The WebService Class.

#60623
Aug 17, 2012 15:23
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.