0
votes

I am creating a custom extension for DNN using Christoc's DotNetNuke Module and Theme Development Template

I want to call server side methods using ajax inside my javascript file

example code

$.ajax({
  url:'myModule/listOfPosts'
  success:function() {
    // do something with list of posts    
  }
});

How can i do this? I am open to all suggestions. Thank You

2

2 Answers

0
votes

I did a tutorial on exactly this topic. Building DNN framework services for your module and then calling them securely using jquery ajax.

Client-centric module development

Also, I have another example on my website:

Rich-client Module with Knockout

0
votes

You can also do it using AjaxPro.dll. Here is the codeplex URL: AjaxPro 2

Design Section:

<asp:CheckBox ID="chkDelete" runat="server" onclick="javascript:deleteRecord();" />

Javascript:

<script type="text/javascript">

function deleteRecord() {
    Modules.MyAdmin.ViewCars.deleteCar();  // asynchronous call        
}

Code Behind:

namespace Modules.MyAdmin 
{
    public partial class ViewCars : PortalModuleBase
    {   
          [AjaxPro.AjaxMethod]
          public void deleteCar()
          {    
              // Write your action over here  
          }
    }
 }