Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...jQuery problemjQuery problem
Previous
 
Next
New Post
6/29/2011 4:54 PM
 
I'm having a problem getting a jQuery call to fire off a method on the server.  I have successfully got the code to work using a regular ASP. Net webpage, but I have not been able to get it to work successfully within a DNN module.  I do know the jQuery is executing because if I call an alert method instead of the Ajax call, it works great.  But if I put a break point on my method, it never hits the break point and the error method is always called.



Here is my HTML:
<input id="Button3" type="button" value="button3" />


Here is my jQuery:

jQuery(document).ready(function () {
        jQuery('#Button3').click(function () {
            jQuery.ajax({
                type: "POST",
                url: "http://dnndev/FileUpload.aspx/GetDate",
                contentType: "application/json; charset=utf-8",
                data: "{}",
                dataType: "json",
                success: function () {
                     success!");
                },
                error: function () {
                     failed!");
                }
            });
        });
    });


Here is my registration on Page_Load:

private void Page_Load(object sender, System.EventArgs e)
        {
            DotNetNuke.Framework.jQuery.RequestRegistration();
 
            try
            {
 
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }


Here is the method:
[WebMethod]
        public static string GetDate()
        {
            return DateTime.Now.ToString();
        }


Am I missing something specific to DNN?  Any help or direction would be greatly appreciated!



Thanks!

Jay







 
New Post
6/30/2011 9:33 AM
 
After more research, it appears that the url might be the problem (url: "http://dnndev/FileUpload.aspx/GetDate").  Since my jQuery resides on my module, from reading around, it appears that I'm trying to call a method from a web control basically and there is no direct path to the method.  So the URL shown above isn't a valid path and thefore that is why it always throws an error, if that make sense.  I wonder if I put the jQuery in the page header?
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...jQuery problemjQuery problem


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out