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
var x = $.ajax({ | |
type: "POST", | |
url: "some.php", | |
data: "name=John&location=Boston", | |
success: function(msg){ | |
alert( "Data Saved: " + msg ); | |
} | |
}); | |
//kill the request |
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
//closure | |
(function($) { | |
//permitimos acceso externo a las opciones por defecto | |
$.fn.pluginName.defaults = { | |
option1: "whatever", | |
option2: "", | |
option3: 9, | |
option4: true | |
} |
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
if(navigator.userAgent.match(/iPhone/i)){ | |
window.location = "/iphone/"; | |
} |
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
//para debugear con mensajes | |
$.log = function(message) { | |
if(window.console) { | |
console.debug(message); | |
} else { | |
alert(message); | |
} | |
}; | |
//para hacer un alert del objeto |
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
//plugin para aplicar en textarea/inputs para que cuando tenga el foco se elimine el contenido | |
$.fn.autoClean = function() { | |
return this.filter('input, textarea').each(function(){ | |
var $this = $(this); | |
$this | |
.attr('default',$this.val()) | |
.focus(function(){ | |
if ( $this.attr('id') == 'terms' ) { | |
if ($this.val() == $this.attr('title') ) $this.val(''); | |
} else { |
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
//validacion de mail | |
function validarmail(email){ | |
return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)); | |
} |
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
/******* | |
*** Anchor Slider by Cedric Dugas *** | |
*** Http://www.position-absolute.com *** | |
Never have an anchor jumping your content, slide it. | |
Don't forget to put an id to your anchor ! | |
You can use and modify this script for any project you want, but please leave this comment as credit. | |
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 isFunction(a) { | |
return typeof a == 'function'; | |
} | |
function isNull(a) { | |
return typeof a == 'object' && !a; | |
} | |
function isNumber(a) { | |
return typeof a == 'number' && isFinite(a); | |
} | |
function isObject(a) { |
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
/* | |
we have: | |
http://foo.com?nodeId=2&userId=3&sortOrder=name&sequence=asc | |
we want: | |
var params = { | |
nodeId : 2, | |
userId : 3, | |
sortOrder: name, | |
sequence: asc |
OlderNewer