SneakyBrian / PokerOdds

ASP.NET MVC 4 Web API Example
5 stars 4 forks source link

Demo site / parsing xml? #1

Open JMKelley opened 10 years ago

JMKelley commented 10 years ago

Just wondering how you are parsing the XML on the demo site?

JMKelley commented 10 years ago

Also, getting cross domain origin errors when calling the API via Ajax.

$(document).ready(function () {

$("#tappy").on('click', function () {

    var myHand = $("#current-hand").val();
    var currentDeck = $("#current-deck").val();

    $.ajax({
        url: "http://pokerodds.azurewebsites.net/api/TexasHoldem/?pocket=" + myHand + "&board=" + currentDeck,
        type: "GET",
        dataType: "XML",
        success: function(data) {

        //Use received data here.
        alert("test");

        },
        error: function(jqXHR, textStatus, errorThrown ){
          // debug here
        }
    });

});

});