This file contains hidden or 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
| //Uses jQuery's serialize form method & then transforms data into an object | |
| var data = {}; | |
| $.each( $( "#Form" ).serialize().split( "&" ), function( index, item ) { | |
| var keyValue = item.split( "=" ); | |
| data[ keyValue[ 0 ] ] = decodeURIComponent( keyValue[ 1 ] ).replace( /\+/g, " " ); | |
| }); | |
| console.log( JSON.stringify( data, null, 4 ) ); |
This file contains hidden or 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
| jsbin.settings.editor.theme = "monokai"; | |
| jsbin.settings.editor.indentUnit = 4; | |
| jsbin.settings.editor.smartIndent = true; | |
| jsbin.settings.editor.tabSize = 4; | |
| jsbin.settings.editor.indentWithTabs = true; | |
| jsbin.settings.editor.autoClearEmptyLines = true; | |
| jsbin.settings.editor.lineWrapping = true; | |
| jsbin.settings.editor.lineNumbers = true; | |
| jsbin.settings.editor.matchBrackets = true; |
The following are links to information about this presentation. I've recorded the talk previously at aspConf that you can watch or share. The HTML slides are provided below and are based on a multipart blog series. If you are interested in digging into each point of the talk I've put together a hands on Lab that is unit test based with instructions to help you walk through fixing each bug.
- Video http://j.mp/find-jquery-bugs-post
- Slides http://j.mp/find-jquery-bugs-slides
- Blog Series http://j.mp/find-jquery-bugs-series
- Unit Testing Lab http://j.mp/find-jquery-bugs-lab
This file contains hidden or 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 deferredRequest( resource, data ) { | |
| return $.Deferred(function( dfd ) { | |
| amplify.request({ | |
| resourceId: resource, | |
| data: data, | |
| success: dfd.resolve, | |
| error: dfd.reject | |
| }); | |
| }).promise(); | |
| } |
This file contains hidden or 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 deferredRequest( resource, data ) { | |
| return $.Deferred(function( dfd ) { | |
| amplify.request({ | |
| resourceId: resource, | |
| data: data, | |
| success: dfd.resolve, | |
| error: dfd.reject | |
| }); | |
| }).promise(); | |
| } |
This file contains hidden or 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
| /; ;\ | |
| __ \\____// | |
| /{_\_/ `'\____ | |
| \___ (o) (o } | |
| _____________________________/ :--' DRINKA | |
| ,-,'`@@@@@@@@ @@@@@@ \_ `__\ | |
| ;:( @@@@@@@@@ @@@ \___(o'o) | |
| :: ) @@@@ @@@@@@ ,'@@( `====' PINTA | |
| :: : @@@@@: @@@@ `@@@: | |
| :: \ @@@@@: @@@@@@@) ( '@@@' |
This file contains hidden or 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
| { | |
| "globals": { | |
| "console": false, | |
| "jQuery": false, | |
| "_": false | |
| }, | |
| "maxparams": 5, | |
| "maxdepth": 5, | |
| "maxstatements": 25, | |
| "maxcomplexity": 10, |
This file contains hidden or 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
| amplify.request.define( "getMovies", "ajax", { | |
| url: "http://odata.netflix.com/Catalog/Titles?$filter=substringof('{criteria}',Name)&$callback=?&$format=json", | |
| dataType: "jsonp", | |
| cache: 1000, | |
| decoder: function ( data, status, xhr, success, error ) { | |
| if ( status === "success" ) { | |
| success( data.d.results ); | |
| } else if ( status === "fail" || status === "error" ) { | |
| error( data.message, data.status ); | |
| } else { |
This file contains hidden or 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
| // Define what a getTweets request looks like... url, dataType, etc | |
| amplify.request.define( "getTweets", "ajax", { | |
| url: "http://twitter.com/status/user_timeline/{userName}.json", | |
| dataType: "jsonp", | |
| type: "GET" | |
| }); |