Title: Header already sent
Last modified: August 20, 2016

---

# Header already sent

 *  [seyha](https://wordpress.org/support/users/seyha/)
 * (@seyha)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/header-already-sent-1/)
 * 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.

 * 0 replies
 * 1 participant
 * Last reply from: [seyha](https://wordpress.org/support/users/seyha/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/header-already-sent-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
