User Tools

Site Tools


jquery:allgemein

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
jquery:allgemein [2014/04/09 12:16] – [AJAX post request] adminjquery:allgemein [2021/12/06 21:25] (current) – removed admin
Line 1: Line 1:
-====== jQuery ====== 
  
-eigene Selektoren erstellen wie [[http://www.bennadel.com/blog/547-jQuery-Custom-Selectors-Holy-Cow-That-Is-So-Badass-.htm|hier]] 
- 
-<code javascript> 
-$.extend( 
-$.expr[":"], { 
- hottie: ("jQuery( a ).attr( 'rel' ) == 'girl' && " + "jQuery( a ).attr( 'hotness' ) >= 9") 
-}); 
- 
-function FindHotties() { 
- $("ol a:hottie").css("font-weight", "bold"); 
-} 
-</code> 
- 
- 
-===== HTML5 - Detect geolocation ===== 
- 
- 
-<code javascript> 
-// ASK GOOGLE FOR COUNTRY'S SHORT_NAME 
-if (navigator.geolocation) { 
- navigator.geolocation.getCurrentPosition(function(position) { 
- $.getJSON('http://maps.googleapis.com/maps/api/geocode/json', { 
- latlng: position.coords.latitude + ',' + position.coords.longitude, 
- sensor: false, 
- type: 'JSON' 
- }, function(result) { 
- var countryKey = result.results[0].address_components[5].short_name; 
- console.log(countryKey); 
- alert('ITs AMAZING! LOOK AT THIS = ' + countryKey); 
- }); 
- }); 
-} 
-</code> 
- 
-===== AJAX post request ===== 
- 
-<code javascript> 
-$.ajax({ 
- dataType: "json", 
- type: "post", 
- url: "file.php", 
- data: "id=5&BigBoobies=true", 
- success: function(data) { 
- // SQUEEZE OUT DATA 
- console.log(data); 
- } 
-}); 
-</code> 
- 
-===== AJAX form post ===== 
- 
-<code javascript> 
- 
-$("#idForm").submit(function() { 
-    var uri = "index.php"; 
-    $.ajax({ 
-           type: "POST", 
-           url: uri, 
-           data: $("#form").serialize(), 
-           success: function(data) { 
-               alert(data); 
-           } 
-         }); 
-    return false; // avoid to execute the actual submit of the form. 
-}); 
- 
-</code> 
jquery/allgemein.1397045774.txt.gz · Last modified: by admin