Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as HTML by pradeep ( 13 years ago )
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Plugin Demo</title>
[removed][removed]

</head>
<body>
 <h1>Wiki Search</h1>
 <br />
 <input id="searchterm" />
 <button id="search">Search</button>
 <div id="results"></div>

[removed]
 $('#search').click(function(e){
  var q=$("#searchterm").val();
  $.getJSON("http://en.wikipedia.org/w/api.php?callback=?",
   {
    srsearch:q,
    action: "query",
    list: "search",
    format:"json"
   },
   function(data){
    console.log(data);
    $('#results').empty();
    $('#results').append("<p> Results for <b>" + q + "</br></p>");
    $.each(data.query.search, function(i,item)
      {
      $('#results').append("<div><a href='http://en.wikipedia.org/wiki/'>" + item.title +
        "</a><br>" + item.snippet + "<br><br></div>");
      });
    
   });
  
 });
[removed]

</body>
</html>

 

Revise this Paste

Your Name: Code Language: