Difference between revisions of "Jquery"
From Wiki2
Line 1: | Line 1: | ||
====$.post $.get==== | ====$.post $.get==== | ||
< | <syntaxhiglight> | ||
$.post("../services/hold.php", {data: holdStr}).done(function(data){ | $.post("../services/hold.php", {data: holdStr}).done(function(data){ | ||
//alert("Data Loaded: " + data); | //alert("Data Loaded: " + data); | ||
Line 10: | Line 10: | ||
: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 | ||
< | <syntaxhighlight> | ||
$("#quesfrom").autocomplete({ | $("#quesfrom").autocomplete({ | ||
source: function(request, response) { | source: function(request, response) { | ||
Line 19: | Line 19: | ||
//$.getJSON("../tm/smcompl.php", {term: extractLast(request.term)}, response); | //$.getJSON("../tm/smcompl.php", {term: extractLast(request.term)}, response); | ||
}, | }, | ||
</ | </syntaxhighlight> |
Revision as of 17:33, 22 March 2013
$.post $.get
<syntaxhiglight>
$.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>