Title: How to develop plugin with ajax
Last modified: August 20, 2016

---

# How to develop plugin with ajax

 *  [seyha](https://wordpress.org/support/users/seyha/)
 * (@seyha)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/how-to-develop-plugin-with-ajax/)
 * Dear all,
 * I develop one plugin and I used ajax as below in my plugin file:
 * <script type=”text/javascript” src=”[http://code.jquery.com/jquery-latest.js”></script&gt](http://code.jquery.com/jquery-latest.js”></script&gt);
   
   <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: “functions.php”, data: form_data, 
   success: function(result) { $(“#message”).html(result); } });
 *  });
    }); </script>
 * When I deactivate it works normally but when I active in show an error like this:
 * The plugin generated 3 characters of unexpected output during activation. If 
   you notice “headers already sent” messages, problems with syndication feeds or
   other issues, try deactivating or removing this plugin.
 * I think this error because of the Javascript Code it provide some space to php
   file.
 * My question is: How can we put javascript code into plugin file?

The topic ‘How to develop plugin with ajax’ 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/how-to-develop-plugin-with-ajax/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
