Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

I wrote a javaScript which will call one of the JSON API web services when the user click on a button , so i wrote the following inside a custom HTML field on the Joget form builder, but nothing will be displayed when the user click on the button and only the #title will be changed.

Code Block
langjavascript
    <script language="JavaScript">

   function test () {
    $.ajax({
        url: "http://localhost:8080/jw/web/json/workflow/package/list",
        type: "GET",
        cache: false,
        success: function (result) {


            $('#products').empty();
            $('#title').text("All Processes");
            $.each(result.data, function (key, val) {
                var str = val.packageName;
                $('<li/>', { text: str })
                    .appendTo($('#products'));
            });


        }
    });
};
    </script>
    <form name="myForm">
      <input type="button"
             value="Display alert box"
             name="button1"
             onClick="alert('You clicked the first button.')"><br>
      <input type="button"
             value="Call on button 1"
             name="button2"
             onClick="test()">
<h1 id ="title"></h1>

<ul id="products">

</ul>

    </form>

Can anyone advice how can i make my code works well . baring in mind that i run my code inside a visual studio web project and the above code worked well and the list of packages which were returned from the APi call were displayed successfully.

Best Regards