Difference between revisions of "Jquery"

From Wiki2
Line 1: Line 1:
====$.post $.get====
<syntaxhightlight>
    $.post("../services/hold.php", {data: holdStr}).done(function(data){
        //alert("Data Loaded: " + data);
    });
</syntaxhighlight>
====autocomlete====
You can send more info to the autocomplete script:
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  
:In this case &course:33duck gets appended to the get string going to ../tm/smcompl.php  
::from: /assess/combine/createCquiz.html
::from: /assess/combine/createCquiz.html
<pre>
<syntaxhightlight>
$("#quesfrom").autocomplete({
    $("#quesfrom").autocomplete({
source: function(request, response) {
        source: function(request, response) {
$.getJSON("../tm/smcompl.php", {
            $.getJSON("../tm/smcompl.php", {
term: extractLast(request.term),
                term: extractLast(request.term),
course: document.getElementById("numques").value + 'duck'
                course: document.getElementById("numques").value + 'duck'
}, response);
            }, response);
//$.getJSON("../tm/smcompl.php", {term: extractLast(request.term)}, response);
        //$.getJSON("../tm/smcompl.php", {term: extractLast(request.term)}, response);
},
        },
</pre>
</syntaxhightlight>

Revision as of 17:32, 22 March 2013

$.post $.get

<syntaxhightlight>

   $.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

<syntaxhightlight>

   $("#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);
       },

</syntaxhightlight>