I want to retrieve the list of processes from my Joget workflow, so i wrote the following javaScript to retrieve the  ID & packageName and display them in a list:-

 <script type="text/javascript">
            $(document).ready(function () {
                // Send an AJAX request
                $.getJSON("http://localhost:8080/jw/web/json/workflow/process/list?j_username=kermit&hash=9449B5ABCFA9AFDA36B801351ED3DF66&loginAs=admin",
                function (data) {
                    // On success, 'data' contains a list of products.
                    $.each(data, function (key, val) {

                        // Format the text to display.
                        var str = val.id + ': $' + val.packageName;

                        // Add a list item for the product.
                        $('<li/>', { text: str })
                        .appendTo($('#products'));
                    });
                });
            });
</script>
<h1>The Processes are</h1>
<ul id="products"/

<h1>The Processes are </h1>
 <ul id="products"/>

But when i run the above web page no processes will be displayed under the <h1>The Processes are </h1> , while if i type the following http://localhost:8080/jw/web/json/workflow/process/list?j_username=kermit&hash=9449B5ABCFA9AFDA36B801351ED3DF66&loginAs=admin&nbsp; directly on the address-bar of my browser then all the processes will be displayed. so what might be going wrong ?

BR 

  • No labels

4 Comments

  1. i updated my JavaScript to the following:-

    $(document).ready(function(){
    
               $.ajax({
                   type: "GET",
                   url: "http://localhost:8080/jw/web/json/workflow/package/list?loginAs=admin",
    
                   dataType: "JSONP",
                   contentType: "application/json; charset=utf-8",
                   success: function (data) {
                       $.each(data, function (key, val) {
    
                           // Format the text to display.
                           var str = val.packageId + ': $ ' + val.packageName;
    
                           // Add a list item for the product.
                           $('<li/>', { text: str })
                           .appendTo($('#products'));
    
                       });
                   }});
               });
           

    but the result of the web service call is returned as

    • undefined: $ undefined

    So what is the problem that is preventing my code from displaying the right data ?

    1. Hi John,

      Just a quick check, is your application hosted on the same domain as Joget?

      Cheers.

      1. no they are on different domains, but will this cause any problem ??

  2. I modify my java script to the following and it worked fine:-

    function (result) {
    $.each(result.data, function (key, val) {