See our PI#enterprise Add-Ons for the latest method to Customize Form JavaScript & CSS settings.
Suggested pre-requisites:
- Moderate understanding of JavaScript, jQuery and Ajax
- Basic knowledge how to enable forms editing and to input code within a Project Insight form
- Understanding Web APIs and JSON objects
Start by "enabling forms editing within your Project Insight."
The following example will create a ToDo item then load it to view/display.
$(function() { // Handler for .ready() called. $.get( "/api/to-do/{GUID}", function( data ) { alert( "Data Loaded: " + data ); }); });
Figure 1 - Add an Ajax 'GET' method to return a response from the Project Insights Web Api.Tip: You can request a method from any URL (as long it is valid). Also, "GUID" and "Id" are interchangeable and used to retrieve the item.
The example above will make a request and return a response "data". We can then debug to the console window or alert the client with the object returned.
When you reload the page; the jQuery will execute with the AJAX method that will perform a 'GET'. Once the response is returned, we call perform an alert or set a debugger to "see" the actual execution and the response object.
With just a few lines of code and configuration within Project Insight, you'll be able to leverage and customize your environment to your specifications!
If you have any further questions or comments, please leave them below.
Happy coding!
Comments
0 comments
Please sign in to leave a comment.