28 lines
563 B
PHP
28 lines
563 B
PHP
<?php
|
|
|
|
function wp_model_plugin_content() {
|
|
echo "
|
|
<input type='text' id='mytext'>
|
|
<button id='mybutton'>send</button>
|
|
|
|
<script>
|
|
const inputElement = document.getElementById('mytext');
|
|
const sendButton = document.getElementById('mybutton');
|
|
|
|
sendButton.addEventListener('click', () => {
|
|
const inputValue = inputElement.value;
|
|
const myurl = php_data.ajax_url;
|
|
console.log(myurl);
|
|
|
|
fetch(url, {
|
|
method: 'POST',
|
|
credentials: 'same-origin',
|
|
body: JSON.stringify({ data: inputValue })
|
|
})
|
|
});
|
|
</script>
|
|
";
|
|
}
|
|
|
|
?>
|