javascriptjqueryjquery-mobilejsonp

JavaScript function undefined from console no visible response


I've got this function in the body of my jQuery Mobile page:

    <script>
        function theManufacturers(inputSearch){
            var qryString = 0;
            
            //set up string for adding <li/>
            var li = "";
            var jqxhr = $.getJSON("http://someurl.com/page.aspx?sumvar=hello&callback=?",
            function(data){
                    $.each(data.items, function(i,item){
                        li += '<li><a href="#" id="' + i + '" class="info-go">' + item.Manufacturer + '</a></li>';
                    });
                    $("#manufacturer-list").append(li);
                    $("#manufacturer-list").listview("refresh");
                });
            //jqxhr.done(function() {
             //   console.log( "second success" );
            //});
        };
    </script>

I've tried calling it form the console in Firebug and the command just turn blue and then the line underneath in grey says "undefined". And obviously the function doesn't appear to be doing anything.


Solution

  • As pointed out by T.J.Crowder & Bill Crisswell, the undefined response was to be expected and is doesn't actually suggest anything wrong with my JS function.

    The actual problem was that I'd copied the code across from another page in the project and hadn't updated the references to the correct listview in my JS. Hence the listview on the page wasn't being populated with the resultant data pulled in by the function.

    At least I learned that the undefined console response was the correct output for my JS, and I now know why. Thanks to everyone who pointed this out.