Add custom subscription form to my website not working

Hi
I’m trying to add a custom subscription form to my website. I follow this link but not working
https://www.phplist.org/manual/books/phplist-manual/page/creating-a-subscribe-page

the code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<form method="post" name="subscribeform" id="subscribeform" enctype="multipart/form-data"> <table border=0> <tr> <td><div class="required">Email</div></td> <td class="attributeinput"><input type=text name="email" value="" id="email" size="40"></td> </tr> </table> <input type=hidden name="htmlemail" value="1"> <input type="hidden" name="list[11]" value="signup" /> <input type="hidden" name="subscribe" value="subscribe"/> <button class='button' onclick="if (checkform()) {submitForm();} return false;" >Subscribe</button> <div id="result" style="color: red;"></div> </form>

<script type="text/javascript"> function checkform() { re = /^\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/; if (!(re.test(jQuery("#email").val()))) { jQuery("#result").empty().append("Please enter a valid email address"); jQuery("#email").focus(); return false; } return true; } function submitForm() { successMessage = 'Thank you for your registration. Please check your email to confirm.'; data = jQuery('#subscribeform').serialize(); jQuery.ajax( { type: 'POST', data: data, url: 'http://mydomain.com/lists/?p=subscribe&id=1', dataType: 'html', success: function (data, status, request) { jQuery("#result").empty().append(data != '' ? data : successMessage); jQuery('#email').val(''); }, error: function (request, status, error) { alert('Sorry, we were unable to process your subscription.'); } }); } </script>

but I got this error in the console.

Access to XMLHttpRequest at 'http://mydomain/lists/?p=subscribe&id=1' from origin 'http://mywebsite' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://mydomain' that is not equal to the supplied origin.
mydomain/lists/?p=subscribe&id=1:1 Failed to load resource: net::ERR_FAILED

Any advice to solve the issue?