Errors when working through Web API/HTML5 blog by Marcus

Discussion created by GPaterson on Aug 19, 2014
Latest reply on Aug 22, 2014 by Marcos Vainer Loeff



I'm new to the PI Web API and I'm trying to get the code in Marcus's blog to work. The post is here:


I'm new to javascript/jquery debugging so bear with me and let me know if I'm heading in the wrong direction.


I am getting errors when trying to get the historical data, the snapshot data works. The errors I see are:


You can see that the URL has "undefined" in it. I think I've traced this issue down to something that is happening within the JQuery library. When it executes the StartRetrievalMethod the RetrievalMethodData parameter is Undefined.



function StartRetrievalMethod(PerformRequest, RetrievalMethodName, TableToAdd, RetrievalMethodClass, RetrievalMethodData ) {

    if (PerformRequest == "yes") {
        try {
            for (var i = 0; i < RetrievalMethodData["Items"].length; i++) {
                $('<tr/>', {
                    'id': RetrievalMethodName + 'Tr' + i,
                $('<td/>', {
                    'text': RetrievalMethodData["Items"]
                }).appendTo('#' + RetrievalMethodName + 'Tr' + i);
                $('<td/>', {
                    'text': RetrievalMethodData["Items"]
                }).appendTo('#' + RetrievalMethodName + 'Tr' + i);



 The reason I say I think it's something with Jquery is that when the URL is passed to Jquery it looks ok. Here is the "Target" Url when it is inside of Jquery getting rattled around:




One major problem I have right now is that when debugging in firebug it hangs when it gets to return jqXHR inside of jquery so I can't step through that. Perhaps that's part of the problem?


Any help or pointing me in the right direction is much appreciated.