Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. insert and load Record using ajax
  2. $(function() {
  3. $(".comment_button").click(function()
  4. {
  5.   var test = $("#contact").val();
  6.    var dataString = 'contact='+ test;
  7.      if(test=='')
  8.    {
  9.    alert("Please Enter Some Text");
  10.    }
  11.   else
  12.   {
  13.    $("#flash").show();
  14. $("#flash").fadeIn(400).html('<img src="ajax-loader.gif" align="absmiddle">       <span              class="loading">Loading Comment...</span>');
  15. $.ajax({
  16. type: "POST",
  17.  url: "ContactsHandler.php",
  18.   data: dataString,
  19.  cache: false,
  20.  success: function(html){
  21. $("#display").after(html);document.getElementById('contact').value='';                                document.getElementById('contact').focus();
  22.  $("#flash").hide();
  23.       }}); } return false;  }); });
  24. </script>
  25.        
  26. <input type="submit" value="Save contact" id="contact"name="todo"class="comment_button"/>