kouros91
Member
Code:
{source}
<!-- You can place html anywhere within the source tags -->
<button id="reinitable" onClick="reinitable()";>R?initialiser les tables</button>
<script language="javascript" type="text/javascript">
function reinitable() {
var r = confirm("Voulez-vous vraiment r?initialiser les tables ?");
if (r == true) {
function retable (xxy) {
var url = "index.php?option=com_fabrik&format=raw&task=plugin.userAjax&method=reinitialisetables&idfiche=" + xxy;
new Request({url:url,
onComplete: function(response) {
if (response != '') {
alert(response);
}
}
}).send();
}
retable (1);
}
}
</script>
<?php
// You can place PHP like this
?>
{/source}
I've created buttons in an article . They call userajax fabrik functions.
When it's in the article intro in a fabrik list loaded, it works . When i want to create an article alone with only my buttons and js code with sourcerer, without any list, . It doesn't work. UserAjax is not called.
When i put window.open(url,"_self"); instead of New Request .... , it works (without the response in a messagebox). It seems that function Request doesn't work with article alone.
Here is the erro message from console :
Uncaught TypeError: (intermediate value).send fonctions-superviseurs:222
at retable (fonctions-superviseurs:222)
at reinitable (fonctions-superviseurs:226)
at HTMLButtonElement.onclick (fonctions-superviseurs:196)
fonctions-superviseurs is the alias of my article.
How do i do ?
Thank you.
Nicolas
Last edited: