I am working in codeigniter. I have an error in javascript code. I have a login form and want to show a javascript alert box if the login name or user name is wrong. I had completed my project on localhost and javascript is working fine on localhost. But when i upload the project on live server, it displays an error message.
A PHP Error was encountered
Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /home/servername/public_html/projectdemo/wms/application/controllers/login.php:36) Filename: helpers/url_helper.php Line Number: 540
I put this javascript code in controller
<script type='text/javascript'>
function jsfunction()
{
window.alert("Wrong User Name or Password");
}
</script>
and in controller, I called this function:
echo "<script type='text/javascript'>jsfunction();</script>";
Later I put the script in head section but same error message appears.
Can you please help me.
Thanks in advance.