JSFiddle - React, Tailwind, and code Playground
by jfroom
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form id="myform">
<input id="myinput" name="myinput" type="text"/>
<input type="submit" />
</form>
</body>
</html>
JavaScript
$(document).ready( function(){
/*
$("#inputid").change(function (){
sendQuery($("#myinput").val());
//http://www.pillsbury.com/Services/PredictiveSearch/SearchSuggestionService.svc/json/suggestions?q=buttermilk&limit=10×tamp=1326745227322&terms=buttermilk*
});
*/
function sendQuery(s){
var strURL = "http://www.pillsbury.com/Services/PredictiveSearch/SearchSuggestionService.svc/json/suggestions";
var now = new Date();
var request = {
url:strURL,
context:document.body,
success: function (data, textStatus, jqXHR){
alert("success ");
},
error: function (jqXHR, textStatus,errorThrown){
alert("error " + jqXHR + " textStatus:" + textStatus + " errorThrown:" + errorThrown);
},
complete:function(jqXHR, textStatus){
alert("complete " + jqXHR + " textstatus:" + textStatus);
},
crossDomain:true,
dataType:"jsonp",
data:{
q:s,
limit:10,
timestamp:now.getTime(),
terms:s + "*"
}
};
$.ajax(request);
};
sendQuery("buttermilk");
});