This is a migrated thread and some comments may be shown as answers.

Request using AJAX to WEB API

1 Answer 97 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Denis
Top achievements
Rank 2
Denis asked on 03 Dec 2012, 06:56 PM
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
                }

1 Answer, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 06 Dec 2012, 10:50 AM
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.
Tags
Ajax
Asked by
Denis
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Share this question
or