JQuery AJAX call from ASCX not working - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

JQuery AJAX call from ASCX not working

  • JQuery AJAX call from ASCX not working
  • We have created a custom ASP.NET control and it is making an AJAX call to another page using JQuery.

    Here is some part of the HTML

    <%@ Control Language="vb" CodeBehind="ReferralForm.ascx.vb" Debug="true" Inherits="MarketingReferral.ReferralForm" %>
    <script src="Scripts/jquery-1.9.0.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function ()         $("select[id$=drpd_PrefStaffPreson]").change(function ()
                var v = $("select[id$=drpd_PrefStaffPreson]").val();
                var t = $("select[id$=drpd_PrefStaffPreson]  option:selected").text();
                );            $("select[id$=drpd_PrefBranch]").change(
                function ()
                    var brnch = $("select[id$=drpd_PrefBranch]").val();
                        type: "POST",
                        url: 'ReferralHelper.aspx/GetStaff',
                        data: "branch: '" + brnch + "'",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json",
                        success: function (response)

    /************** Rest Truncated ***************/

    When we run the control in sitefinity, the AJAX call fails and it gives an error message saying 'not found' (which I assume is the page ReferralHelper.aspx). We have kept the page in sitefinity web root. How can we get this working?

  • Hello KJ Singh,

    Can you try inspecting the POST request using Firebug on firefox.? This way you could see what URL it is making the request to and can correct the URL if it is wrong.  Please also try going to the page manually through the browser to verify if the page in question in fact does exist at the URL that you are trying to access it.

    Venkata Koppaka
    the Telerik team
  • url: 'ReferralHelper.aspx/GetStaff'

    Isn't that meant to have a forward slash in front, if your aspx page is in the web root? e.g.,:
    url: '/ReferralHelper.......
  • Hi,

    Actually the request should begin with the protocol, followed by the path to your page.
    Example: http://localhost:81/YourPage.aspx
    This is not Sitefinity related, but more like general AJAX.
    Try to make request using full url to your page and contact us back if the problem remains.

    All the best,
    the Telerik team