File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 546
546
responseContainer . id = "responseContainer" + Math . floor ( Math . random ( ) * Math . pow ( 10 , 10 ) ) ;
547
547
responseContainer . style . display = "none" ;
548
548
document . body . appendChild ( responseContainer ) ;
549
- const temp = document . createElement ( "a " ) ;
550
- temp . id = "temp" ;
551
- temp . style . display = "none" ;
552
- document . body . appendChild ( temp ) ;
553
- temp . href = `javascript: fetch("${ url } ", ${ JSON . stringify ( options ) } )
549
+ const temp = document . createElement ( "button " ) ;
550
+ temp . setAttribute ( "type" , "button" ) ;
551
+ temp . setAttribute (
552
+ "onclick" ,
553
+ ` fetch("${ url } ", ${ JSON . stringify ( options ) } )
554
554
.then(r => {
555
555
document.querySelector("#${ responseContainer . id } ").innerText = JSON.stringify({
556
556
ok: r.ok,
560
560
});
561
561
return r.text();
562
562
})
563
- .then(t => document.querySelector("#${ outputContainer . id } ").innerText = t)` ;
563
+ .then(t => document.querySelector("#${ outputContainer . id } ").innerText = t)`
564
+ ) ;
565
+ temp . style . display = "none" ;
566
+ document . body . appendChild ( temp ) ;
564
567
temp . click ( ) ;
565
568
// wait for fetch to complete and return a promise
566
569
return new Promise ( ( resolve ) => {
You can’t perform that action at this time.
0 commit comments