- Tue Dec 10, 2019 3:49 am
#827124
Following suggestion posted in Suggested in viewtopic.php?t=709685#p787545
I am trying to execute a 'trigger' code when a button is clicked. FYI, I have constructed the following codes with debug mode enabled.
1st trigger before dynaform - to set a hidden variable named 'app_uid' in the dynaform
I am very sure that the 'success:' block was not executed.
Please assist.
Thank you.
I am trying to execute a 'trigger' code when a button is clicked. FYI, I have constructed the following codes with debug mode enabled.
1st trigger before dynaform - to set a hidden variable named 'app_uid' in the dynaform
Code: Select all
The dynaform JavaScript
@@app_uid = @@APPLICATION;
Code: Select all
2nd trigger (UID:6882411815dedfb9a234b33075746263) to be executed in the above JavaScript code
var host = PMDynaform.getHostName(); // get the hostname
var ws = PMDynaform.getWorkspaceName(); // get the current workspace
var token = PMDynaform.getAccessToken(); // get the access Token
var apiServer = location.protocol + '//' + host + '/api/1.0/' + ws;
var app_uid = $('#app_uid').getValue();
var trigger_uid = '6882411815dedfb9a234b33075746263';
// myBtn OnClick event
$("#myBtn").on("click", function(){
let execute_trigger_url = apiServer + "/cases/" + app_uid + "/execute-trigger/" + trigger_uid;
$.ajax({
url: execute_trigger_url,
data: { abc: 'DEF' },
type: "PUT",
beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'Bearer ' + token);},
success: function(put_data){
console.log(put_data);
}
});
return false; //return false to stop submit action
});
Code: Select all
Problem: I was not able to locate the word 'OK' anywhere not in the debugger window, not in browser's Web Developer console and not in Apache's error.logerror_log('OK'); // sent to apache's error.log
echo 'OK';
I am very sure that the 'success:' block was not executed.
Please assist.
Thank you.