Skip to content

Commit

Permalink
Add ajaxScript function to look-up code snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Nov 26, 2014
1 parent 3dd8320 commit fa2158e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/html/ReqMgr/javascript/ajax_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,19 @@ function ajaxApproveRequests(base, method, ids) {
onComplete : function() {return;}
});
}
function ajaxScript(base) {
// base is a URL base, e.g. https://cmsweb.cern.ch
// get placehoder for code textarea
var cid=document.getElementById('code');
// get value of snippets drop-down menu (see create.tmpl)
var val=document.getElementById('snippets').value;
new Ajax.Updater('response', base+'/scripts',
{ method: 'get' ,
parameters : {'name': val},
onException: function() {return;},
onSuccess : function(response) {
// update code textarea with returned value of script server API
cid.value=response.responseText;
}
});
}

0 comments on commit fa2158e

Please sign in to comment.