More in this section

Forums / Developing with Sitefinity / Problems with ajax jQuery in Sitefinity [403 ]

Problems with ajax jQuery in Sitefinity [403 ]

1 posts, 0 answered
  1. Nicu
    Nicu avatar
    1 posts
    Registered:
    27 Feb 2012
    16 Mar 2012
    Link to this post
    Hello,
     I'm trying to call an asp function with ajax in jQuery, but I get a 403 Error resonse (403 (Forbidden) ) .
    My C# function is called public static string FetchURL(string url) and it's located in /widgets/Api.ascx.cs .This function receives the url as parameter and returns a string.
    I make the ajax request from a .js file, which is called Api.js and it's  located in /widgets/Api.js .

     My ajax function looks like this:
     jQuery.ajax({
            type: "POST",
            url: "Api.ascx/FetchURL",
            data: apiKey,
            success: function (data) {
                content = data;
                alert("data:"+data);
            },
            error: function(req,stat,err){
    alert("Error:"+stat);
                },
        });

    Can somebody tell me what is wrong in the jQuery ajax call ?
1 posts, 0 answered