title: JQuery Auto-complete Ajax validate special characters
body: <p>i want to validate the special characters like !@#$%^&amp;*() entered in the auto complete box and possibly give an alert box message as "Please enter a valid name". Below is my snippet:</p>
  
  <pre><code>$("#txtName").autocomplete({
      source: function (request, response) {
          $.ajax({
              type: "POST",
              contentType: "application/json; charset=utf-8",
              url: "Webservice.asmx/GetNames",
              data: "{'prefixText':'" + request.term + "'}",
              dataType: "json",
              success: function (data) {
                  response($.map(data.d, function (item) {
                      return {
                          label: item.split('|')[0],
                          val: item.split('|')[1]
                      }
                  }))
              },
              error: function (result) {
                  ServiceFailed(result);
              },
              failure: function (response) {
                  ServiceFailed(result);
              }
          });
      },
      select: function (event, ui) {
          autoName(ui.item.val, ui.item.label);
      },
      minLength: 4
  }).data("autocomplete")._renderItem = function (ul, item) {
      var newText = String(item.value).replace(
              new RegExp(this.term, "gi"),
              "&lt;span class='ui-state-highlight'&gt;$&amp;&lt;/span&gt;");
      return $("&lt;li&gt;&lt;/li&gt;")
          .data("item.autocomplete", item)
          .append("&lt;a&gt;" + newText + "&lt;/a&gt;")
          .appendTo(ul);
  }
  </code></pre>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Thanks in advance</p>