Posted By

qrist0ph on 03/16/09


Tagged

ajax jquery cheatSheet


Versions (?)


Advertising

Website Promotion DIRECTORY is a crucial factor for all websites that need to gain better organic search engine rankings and increase website traffic.
Submitting your website as part of your Web Promotion strategy to our SEO friendly and high traffic Business Directory for review is an excellent way to gain a valuable backlink and increase your websites visibility online.

Submit Site


Who likes this?

1 person has marked this snippet as a favorite

qrist0ph


jquery CheatSheet


Published in: HTML 






Expand | Embed | Plain Text
  1. <head>
  2. <title>Titel der Webseite</title>
  3. <!-- Evtl. weitere Kopfinformationen -->
  4. <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
  5. <script type="text/javascript">
  6. function doSomething(){
  7. alert($("#username").val());
  8. $("#eineDiv").html ='<h1 id="toll">textfsfsf</h1>'
  9. }
  10.  
  11. /*
  12. * Ajax XmlHttpRequest senden
  13. */
  14. function login(){
  15. $.getJSON('/login_ajax/',{ name: $("#username").val(), password: "einPassword" }, login_callback);
  16.  
  17. }
  18. /*
  19. * Ajax Callback Funktion
  20. */
  21. function login_callback(json,text){
  22. setCookie('sessionid',json.sessionid,365);
  23. }
  24.  
  25. /*
  26. * Funktionen an bestimmte Elemente haengen
  27. */
  28. $(function () {
  29. $('.add-row').click(function() {
  30. return addForm(this, 'form');
  31. });
  32. })
  33. </script>
  34. </head>
  35. <body onload="doSomething()">
  36.  
  37. <div id="eineDiv"> Webseite</div>
  38. <input type="text" id="username" />
  39. <input type="button" name="Text 1" value="Text 1 anzeigen" onclick="login()">
  40. </body>
  41. </html>
  42. /// ------ Die login callback (mit Pyyhon) -----
  43. from django.utils import simplejson
  44. return HttpResponse(simplejson.dumps({'sessionid':request.session.session_key,'username':user.username}),status=200, mimetype='application/javascript')

Report this snippet 

You need to login to post a comment.

Download royalty free graphics