I don't know pass a id value of php to jquery in moodle. Have a two files index.php and myscript.js
index.php file:
html_writer::tag('button','', array('id' => 'buttonCompile', 'data-url' => $urlbase));
myscript.js file:
$(document).ready(function(){
alert($('#button').attr('id'));
});
i need show the value of 'data-url' in js file
pd: html_writer is a moodle function for write html code, in this case is a button tag.