I am new to JS and I want to open a new window when I click on my button in SugarCRM without browser blocking it.
function authenticateCalendar() {
var result;
var url = app.api.buildURL("Users", 'authenticate_calendar');
app.api.call('retrieve', url, null, {
success: function(data) {
if(data.needAuth) {
result = JSON.parse(data.url) ;
}
else result = false;
}
});
if(result)
window.open(result);
}
<input type="button" onclick="authenticateCalendar();">
Is it possible to get the data.url
string in my function?