Request using AJAX to WEB API

2 posts, 1 answers
  1. Denis
    Denis avatar
    18 posts
    Member since:
    Feb 2012

    Posted 03 Dec 2012 Link to this post

    Hi 

    I am trying to using the telerik library to do a http request to my web api which return a JSON.

    I am not having any result neither and error.

    This my code could somebody help me to see what I am missing.

    Thank you in advance

        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
               <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
             </Scripts>
            </telerik:RadScriptManager>

       function GetApiRequest() {
                        alert(' Beging GetApiRequest');//TEST
                        var jsonResponse = null;
                        $telerik.$.ajax({
                            type: "GET", // HTTP method
                            url: 'http://localhost:3537/api/ipfiltervalues/1?displayFieldID=2', // URL
                            contentType: "application/json; charset=utf-8", //request the result to be in JSON
                            dataType: "json",
                            success: function (result) { //callback method to invoke when the request is complete
                                alert(result);
                                jsonResponse = result;
                            },
                            Error: function (x, y, z) {
                                alert(x + '\n' + u + '\n' + z);
                            }
                        });

                        alert('End GetApiRequest' + jsonResponse);//TEST
                    }
  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 06 Dec 2012 Link to this post

    Hi Denis,

    Please review the answer provided in the support ticket you have opened for the same issue.
    Also please avoid opening duplicate tickets for one problem so we could better track the case and provide proper solution.

    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top