Is it possible to utilize AJAX to run code on a separate HTML page?
In the calling page, the following code is present:
$.ajax({
url: 'ajaxcalled2.html', //This is the current doc
type: "POST",
async: 'false',
dataType: 'json',
data: {username: "ABC123", season: "Winter", email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c3b4aaadb7a6b183adacb1b7abb3acafa6eda0acae">[email protected]</a>"},
complete: function(response){
console.log(response);
}
});
The called page contains the following code:
<html>
<script type="text/javascript">
alert('here');
</script>
</html>
When the calling page is loaded independently, the complete function works fine and there seems to be no issue.
Individually, the called page loads and displays the alert successfully.
However, when they are combined, the alert does not show up.
What could be causing this discrepancy?