Problems with ajax jQuery in Sitefinity [403 ]

Posted by Community Admin on 04-Aug-2018 10:38

Problems with ajax jQuery in Sitefinity [403 ]

All Replies

Posted by Community Admin on 16-Mar-2012 00:00

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 ?

This thread is closed