Skip to content

Instantly share code, notes, and snippets.

@jtmorris
Created June 18, 2013 09:28
Show Gist options
  • Save jtmorris/5803962 to your computer and use it in GitHub Desktop.
Save jtmorris/5803962 to your computer and use it in GitHub Desktop.
JQuery: AJAX
$(document).ready(function(){
$("form#formId").submit(function() {
inputField = $('#inputFieldId').attr('value');
$.ajax({
type: "POST",
url: "yourpage.php",
cache: false,
data: "inputField ="+ inputField,
success: function(html){
$("#ajax-results").html(html);
}
});
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment