This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
$.fn.ajaxify = function(options) { | |
$(this).submit(function(e) { | |
var form = $(this); | |
$.ajax({ | |
type : form.attr('method'), | |
url : form.attr('action'), | |
data : form.serialize(), | |
error : options.error, | |
success : options.success, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<HTML> | |
<HEAD> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(document).ready(function() { | |
$('#form_div').submit(function() { | |
var inputs = []; | |
$(':input', this).each(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AjaxForm() { | |
$("form.ajaxform").submit( | |
function(e) { | |
e.preventDefault(); | |
var dataString = $(this).serialize(); | |
var method = this.method.toUpperCase(); | |
var action = this.action; | |
$.ajax({ | |
type: method, | |
url: action, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var form = $('#form'); // contact form | |
// form submit event |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#thing form').submit(function(e) { | |
var $this = $(this); | |
e.preventDefault(); | |
$.ajax({ | |
type: this.method, | |
dataType: "JSON", | |
url: this.action, | |
data: $this.serialize(), | |
success: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a new dbStore stack | |
var myStack = localStack('myLocalStack'); | |
function onFormSubmit(){ | |
// push form data into local storage | |
myStack.push( $('form').serializeArray() ); | |
// see if we can send data to the server | |
checkForConnection(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var xhr, $form = $('form'); | |
function getResponse(data){ | |
console.log(data); | |
} | |
function postForm(){ | |
return $.ajax({ | |
'dataType' : "jsonp", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @var array $scriptProperties | |
* @var AjaxForm $AjaxForm | |
*/ | |
$AjaxForm = $modx->getService('ajaxform', 'AjaxForm', $modx->getOption('ajaxform_core_path', null, $modx->getOption('core_path') . 'components/ajaxform/') . 'model/ajaxform/', $scriptProperties); | |
if (!($AjaxForm instanceof AjaxForm)) { | |
return ''; | |
} | |
$AjaxForm->initialize($modx->context->key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ Form::open(['data-remote', 'data-remote-success-message' => 'I have now done the thing.']) }} | |
{{ Form::text('name') }} | |
{{ Form::submit('Submit', ['data-confirm' => 'Are you sure?']) }} | |
{{ Form::close() }} |