Title: Ajaxify simple javascript msg
Last modified: August 19, 2016

---

# Ajaxify simple javascript msg

 *  [Modifiedcontent](https://wordpress.org/support/users/modifiedcontent/)
 * (@modifiedcontent)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/ajaxify-simple-javascript-msg/)
 * I’m trying to Ajaxify a javascript error message in an existing WordPress plugin.
   The original code in the plugin looks like this:
 *     ```
       if (msg.length > 0) {
       			msg = "The following fields need to be completed before you can submit.\n\n" + msg;
       			alert(msg);
       			return false;
       		}
   
       	return true;
       ```
   
 * This doesn’t work unfortunately:
 *     ```
       if (msg.length > 0) {
       			msg = "The following fields need to be completed before you can submit.\n\n" + msg;
   
       			if (xmlHttp==null)
       			{
       			alert(msg);
       			return false;
       			}  
   
       			document.getElementById("message").innerHTML = 'Please fill out all required information';
       			return false;
       		}
   
       	return true;   
   
       }
       ```
   
 * What am I missing?

The topic ‘Ajaxify simple javascript msg’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 0 replies
 * 1 participant
 * Last reply from: [Modifiedcontent](https://wordpress.org/support/users/modifiedcontent/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/ajaxify-simple-javascript-msg/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
