Customize header by JavaScript

Hi,
i having a trouble on working with the following code.
what is happening is the “//psearch in the nevbar right” disappears if I change the “status” of “//Banner in the Content Header”.

The following two status i use to enable and disable the banner only.
status 1 = Enabled
status 0 = Disabled

your assistance to solve the issue will be highly appreciated.
Thank you

Actual Code

//psearch in the nevbar right
$(document).ready(function() {
$(“#ew-navbar-right”).prepend(‘

’);
//Banner in the Content Header

<?php $rowh = ExecuteRow("SELECT * FROM ad_header_large WHERE Page_Name=15 AND Status=1 ORDER BY rand()"); ?>

$(“.content-header”).append(“

<a target=‘_blank’ href = ‘<?php echo $rowh['YourLink']; ?>’><img src='data:image/jpeg;base64,<?php echo base64_encode( $rowh['Banner']); ?>'class=‘img-fluid’ alt=‘Responsive image’>
”);
$(“.page-header”).css({“position”: “relative”, “top”: “0px”, “right”:“0px”, “max-width”: “100%”, “max-height”: “100%”});
});

You need to handle when the ExecuteRow() returns an empty result. Double check your code again.

If necessary, press [F12] to see whether any Javascript error message from “Console” section of your browser.

There are two errors:

Error-1
SyntaxError: “” string literal contains an unescaped line break

------------Error 1 gets cleared when i remove this part

<?php $rowh = ExecuteRow("SELECT * FROM ad_header_large WHERE Page_Name=15 AND Status=1 ORDER BY rand()"); ?>

$(“.content-header”).append(“

<a target=‘_blank’ href = ‘<?php echo $rowh['YourLink']; ?>’><img src='data:image/jpeg;base64,<?php echo base64_encode( $rowh['Banner']); ?>'class=‘img-fluid’ alt=‘Responsive image’>
”);
$(“.page-header”).css({“position”: “relative”, “top”: “0px”, “right”:“0px”, “max-width”: “100%”, “max-height”: “100%”});

Error 2
TypeError: document.getElementById(…) is null
all_itemslist.php:1718:124
I have removed the URL(Domain Name from here)/foods/all_itemslist.php:1718

-------------Error 2 gets cleared when i remove this part
loadjs.ready(“load”, function() {
document.getElementById(“ew-modal-dialog”).setAttribute(“data-backdrop”, “static”);
document.getElementById(“ew-add-opt-dialog”).setAttribute(“data-backdrop”, “static”);
});

Tkank you.

  1. Error 1 is just syntax error, you may view the HTML source to your browser to find out what your code outputs and where the unescaped line break is.
  2. Error 2 should be due to wrong position of your code. Where did you put your loadjs.ready(“load”, function() {…})?

Thank you,
I have put the script under Client->global->Page with header/footer->Startup Script