-
-
Save samuelloza/05c510db014f691f7216348e82151f0c to your computer and use it in GitHub Desktop.
JavaScript HElps
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
Interesting Jquery | |
____________________________________________________________________________________ | |
//Añadir elementos a un select | |
$('#mySelect') | |
.append($("<option></option>") | |
.attr("value",key) | |
.text(value)); | |
_____________________________________________________________________________________ | |
selection tag select for select value | |
example : $('#species select option[value="' + + '"]').prop('selected',true); | |
$('#words').val("{{$card_word->id_wd}}").change(); | |
____________________________________________________________________________________ | |
AJAX jquery charge call ajax example | |
http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done | |
$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){ | |
// the code here will be executed when all four ajax requests resolve. | |
// a1, a2, a3 and a4 are lists of length 3 containing the response text, | |
// status, and jqXHR object for each of the four ajax calls respectively. | |
}); | |
function ajax1() { | |
// NOTE: This function must return the value | |
// from calling the $.ajax() method. | |
return $.ajax({ | |
url: "someUrl", | |
dataType: "json", | |
data: yourJsonData, | |
... | |
}); | |
} | |
_____________________________________________________________________________________ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment