Simple JQUERY AJAX POST


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3. $("form#formId").submit(function() {
  4. inputField = $('#inputFieldId').attr('value');
  5. $.ajax({
  6. type: "POST",
  7. url: "yourpage.php",
  8. cache: false,
  9. data: "inputField ="+ inputField,
  10. success: function(html){
  11. $("#ajax-results").html(html);
  12. }
  13. });
  14. return false;
  15. });
  16. });
  17. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.