HI
Can i send some data from extensions to my sql server and get response?
I try it but its not working…
html:
<div id="response"> </div>
<input name='a1' id='a1'>
<button id='ddd'>send</button>
Javascript
$("#ddd").click(function(){
var ra1 = document.getElementById("a1").value;
$.ajax({
type: 'post',
url: 'https://www.my-web.eu/re.php',
data: { a1: ra1 },
success: function (res) {
document.getElementById('response').innerHTML=res;
Thanks
Well what does it say in the console?
This looks like a general “I don’t know Javascript” than an extensions problem?
I allow adress https://code.jquery.com/ on Whitelist URL
I open it on inspect mode
and have this error:
Refused to load the script ‘https://code.jquery.com/jquery-1.10.2.js’ because it violates the following Content Security Policy directive: “script-src ‘self’ https://5ephiv0mjp98oz8s03oasxh6oot00o.ext-twitch.tv https://extension-files.twitch.tv https://www.google-analytics.com”. Note that ‘script-src-elem’ was not explicitly set, so ‘script-src’ is used as a fallback.
and then my main script.js have error :
Uncaught ReferenceError: $ is not defined
at script4.js:1
Can I allow JQUERY?
Thanks
You cannot use external JS in extensions.
All JS (except the TwitchExt JS Helper and Google Analytics) must be included in your local bundle.
See section 2 - Extensions Guidelines & Policies | Twitch Developers
Specifically 2.8
The Allowlist is for allowing you to display functioning <a href="somesite">
links not for external library includes
Thank. I find it and give thats links as file and it works.