Header already sent
-
Dear All,
I have a problem with “Header already sent” with my plugin. I know the problem because of javascript code is in the plugin file as below:
<?php
…
?>
<script type=”text/javascript”>
$(document).ready(function() {$(“#user_login”).blur(function() { // when focus out
$(“#message”).html(‘checking username…’); //before AJAX response
var form_data = {
action: ‘check_username’,
username: $(this).val()
};
$.ajax({
type: “POST”,
url: “<?php bloginfo(‘wpurl’); ?>/wp-content/plugins/sidebar-color/functions.php”,
data: form_data,
success: function(result) {
$(“#message”).html(result);
}
});});
/*$(“#user_login”).focus();*/});
</script>This mean that I have some space after ?> tag. so it provide an error.
My question is : Do we have any way to embed javascript code in the plugin file?Pleas guide me if you know how to fix this problem.
Thanks in advances.
The topic ‘Header already sent’ is closed to new replies.