Jquery

From Wiki2
Revision as of 14:40, 3 February 2014 by Tim (talk | contribs) (→‎$.post $.get)

$.post $.get

<syntaxhighlight lang="js">

   $.post("../services/hold.php", {data: holdStr}).done(function(data){
       //alert("Data Loaded: " + data);
   });

</syntaxhighlight>

autocomlete

You can send more info to the autocomplete script:

In this case &course:33duck gets appended to the get string going to ../tm/smcompl.php
from: /assess/combine/createCquiz.html

<syntaxhighlight>

   $("#quesfrom").autocomplete({
       source: function(request, response) {
           $.getJSON("../tm/smcompl.php", {
               term: extractLast(request.term),
               course: document.getElementById("numques").value + 'duck'
           }, response);
       //$.getJSON("../tm/smcompl.php", {term: extractLast(request.term)}, response);
       },

</syntaxhighlight>

resources

http://www.codeproject.com/Articles/426013/How-jQuery-works