Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

SharePoint app call WebApi service using JSON

$
0
0

Hi

I've made my first SharePoint app and I want to use the following code to get some data from a WebAPI service

$(document).ready(function () {

            var ziua = new Date();
            var id = ziua.getDate();
             
            $.getJSON("http://sp2013:8008/serviciiwebapi/api/aniversati/" + id,
            function (data) {

                
                $.each(data, function (key, val) {
                     
                    var str = val.FirstName + " " + val.LastName;
                    alert(str);
                    
                    $('<li/>', { text: str })
                    .appendTo($('#aniversati'));
                });
            });
        });

but it's never returning data.

The webApi service it's working (I've tested it) and it's on default web site on another port on the same machine as SP

Is it something about cross domain ?

How can i verify ?

Thank you



Sorin Sandu


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>